本文整理汇总了C++中Ship::GetMass方法的典型用法代码示例。如果您正苦于以下问题:C++ Ship::GetMass方法的具体用法?C++ Ship::GetMass怎么用?C++ Ship::GetMass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ship
的用法示例。
在下文中一共展示了Ship::GetMass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Start
//.........这里部分代码省略.........
for (Space::bodiesIter_t i = Space::bodies.begin(); i!=Space::bodies.end(); i++) {
if ((*i)->IsType(Object::SPACESTATION)) {
station = (SpaceStation*)*i;
if (!station->IsGroundStation()) break;
}
}
assert(station);
player->SetPosition(vector3d(0,0,0));
player->SetFrame(station->GetFrame());
player->SetDockedWith(station, 0);
MainLoop();
} else if (choice == 3) {
/* debug start point */
SBodyPath path(1,0,2);
path.sbodyId = 6;
Space::DoHyperspaceTo(&path);
player->SetPosition(vector3d(2*EARTH_RADIUS,0,0));
player->SetVelocity(vector3d(0,0,0));
player->m_equipment.Add(Equip::HYPERCLOUD_ANALYZER);
Ship *enemy = new Ship(ShipType::EAGLE_LRF);
enemy->SetFrame(player->GetFrame());
enemy->SetPosition(player->GetPosition()+vector3d(0,0,-9000.0));
enemy->SetVelocity(vector3d(0,0,0));
enemy->m_equipment.Add(Equip::PULSECANNON_1MW);
enemy->AIKill(player);
Space::AddBody(enemy);
player->SetCombatTarget(enemy);
const ShipType *shipdef;
double mass, acc1, acc2, acc3;
printf("Player ship mass = %.0fkg, Enemy ship mass = %.0fkg\n",
player->GetMass(), enemy->GetMass());
shipdef = &player->GetShipType();
mass = player->GetMass();
acc1 = shipdef->linThrust[ShipType::THRUSTER_FORWARD] / (9.81*mass);
acc2 = shipdef->linThrust[ShipType::THRUSTER_REVERSE] / (9.81*mass);
acc3 = shipdef->linThrust[ShipType::THRUSTER_UP] / (9.81*mass);
printf("Player ship thrust = %.1fg, %.1fg, %.1fg\n", acc1, acc2, acc3);
shipdef = &enemy->GetShipType();
mass = enemy->GetMass();
acc1 = shipdef->linThrust[ShipType::THRUSTER_FORWARD] / (9.81*mass);
acc2 = shipdef->linThrust[ShipType::THRUSTER_REVERSE] / (9.81*mass);
acc3 = shipdef->linThrust[ShipType::THRUSTER_UP] / (9.81*mass);
printf("Enemy ship thrust = %.1fg, %.1fg, %.1fg\n", acc1, acc2, acc3);
/* Frame *stationFrame = new Frame(pframe, "Station frame...");
stationFrame->SetRadius(5000);
stationFrame->m_sbody = 0;
stationFrame->SetPosition(vector3d(0,0,zpos));
stationFrame->SetAngVelocity(vector3d(0,0,0.5));
for (int i=0; i<4; i++) {
Ship *body = new Ship(ShipType::LADYBIRD);
char buf[64];
snprintf(buf,sizeof(buf),"X%c-0%02d", 'A'+i, i);
body->SetLabel(buf);
body->SetFrame(stationFrame);
body->SetPosition(vector3d(200*(i+1), 0, 2000));
Space::AddBody(body);
}
SpaceStation *station = new SpaceStation(SpaceStation::JJHOOP);
station->SetLabel("Poemi-chan's Folly");
station->SetFrame(stationFrame);
station->SetPosition(vector3d(0,0,0));
Space::AddBody(station);
SpaceStation *station2 = new SpaceStation(SpaceStation::GROUND_FLAVOURED);
station2->SetLabel("Conor's End");
station2->SetFrame(*pframe->m_children.begin()); // rotating frame of planet
station2->OrientOnSurface(EARTH_RADIUS, M_PI/4, M_PI/4);
Space::AddBody(station2);
*/
// player->SetDockedWith(station2, 0);
MainLoop();
} else if (choice == 4) {
if (Pi::player) {
Pi::player->MarkDead();
Space::bodies.remove(Pi::player);
delete Pi::player;
Pi::player = 0;
}
Pi::gameMenuView->OpenLoadDialog();
do {
Gui::MainLoopIteration();
} while (Pi::currentView != Pi::worldView);
if (Pi::isGameStarted) MainLoop();
} else {
Pi::Quit();
}
UninitGame();
}