本文整理汇总了C++中Ship::DeathSpiral方法的典型用法代码示例。如果您正苦于以下问题:C++ Ship::DeathSpiral方法的具体用法?C++ Ship::DeathSpiral怎么用?C++ Ship::DeathSpiral使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ship
的用法示例。
在下文中一共展示了Ship::DeathSpiral方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
case INSTRUCTION:
if (elem) {
if (event_param[0])
elem->ClearInstructions();
elem->AddInstruction(event_message);
if (elem->Contains(player) && event_message.length() > 0) {
HUDView* hud = HUDView::GetInstance();
if (hud)
hud->ShowHUDInst();
}
}
break;
case IFF:
if (elem) {
elem->SetIFF(event_param[0]);
}
else if (ship) {
ship->SetIFF(event_param[0]);
}
break;
case DAMAGE:
if (ship) {
ship->InflictDamage(event_param[0]);
if (ship->Integrity() < 1) {
NetUtil::SendObjKill(ship, 0, NetObjKill::KILL_MISC);
ship->DeathSpiral();
Print(" %s Killed By Scripted Event %d (%s)\n", (const char*) ship->Name(), id, FormatGameTime());
}
}
else {
Print(" EVENT %d: Could not apply damage to ship '%s' (not found).\n", id, (const char*) event_ship);
}
break;
case JUMP:
if (ship) {
SimRegion* rgn = sim->FindRegion(event_target);
if (rgn && ship->GetRegion() != rgn) {
if (rgn->IsOrbital()) {
QuantumDrive* quantum_drive = ship->GetQuantumDrive();
if (quantum_drive) {
quantum_drive->SetDestination(rgn, Point(0,0,0));
quantum_drive->Engage(true); // request immediate jump
}
else if (ship->IsAirborne()) {
ship->MakeOrbit();
}
}
else {
ship->DropOrbit();
}
}
}
break;
示例2: if
void
NetGameClient::DoObjKill(NetMsg* msg)
{
if (!msg) return;
NetObjKill obj_kill;
obj_kill.Unpack(msg->Data());
Ship* ship = FindShipByObjID(obj_kill.GetObjID());
if (ship) {
Ship* killer = FindShipByObjID(obj_kill.GetKillerID());
Text killer_name = Game::GetText("NetGameClient.unknown");
if (killer)
killer_name = killer->Name();
// log the kill:
switch (obj_kill.GetKillType()) {
default:
case NetObjKill::KILL_MISC:
Print("Ship '%s' destroyed (misc) (%s)\n", ship->Name(), FormatGameTime());
break;
case NetObjKill::KILL_PRIMARY:
case NetObjKill::KILL_SECONDARY:
Print("Ship '%s' killed by '%s' (%s)\n", ship->Name(), killer_name.data(), FormatGameTime());
break;
case NetObjKill::KILL_COLLISION:
Print("Ship '%s' killed in collision with '%s' (%s)\n", ship->Name(), killer_name.data(), FormatGameTime());
break;
case NetObjKill::KILL_CRASH:
Print("Ship '%s' destroyed (crash) (%s)\n", ship->Name(), FormatGameTime());
case NetObjKill::KILL_DOCK:
Print("Ship '%s' docked (%s)\n", ship->Name(), FormatGameTime());
}
// record the kill in the stats:
if (killer && obj_kill.GetKillType() != NetObjKill::KILL_DOCK) {
ShipStats* kstats = ShipStats::Find(killer->Name());
if (kstats) {
if (obj_kill.GetKillType() == NetObjKill::KILL_PRIMARY)
kstats->AddEvent(SimEvent::GUNS_KILL, ship->Name());
else if (obj_kill.GetKillType() == NetObjKill::KILL_SECONDARY)
kstats->AddEvent(SimEvent::MISSILE_KILL, ship->Name());
}
if (killer && killer->GetIFF() != ship->GetIFF()) {
if (ship->GetIFF() > 0 || killer->GetIFF() > 1)
kstats->AddPoints(ship->Value());
}
}
ShipStats* killee = ShipStats::Find(ship->Name());
if (killee) {
if (obj_kill.GetKillType() == NetObjKill::KILL_DOCK)
killee->AddEvent(SimEvent::DOCK, killer_name);
else
killee->AddEvent(SimEvent::DESTROYED, killer_name);
}
if (obj_kill.GetKillType() == NetObjKill::KILL_DOCK) {
FlightDeck* deck = killer->GetFlightDeck(obj_kill.GetFlightDeck());
sim->NetDockShip(ship, killer, deck);
}
else {
ship->InflictNetDamage(ship->Integrity());
ship->DeathSpiral();
if (!obj_kill.GetRespawn())
ship->SetRespawnCount(0);
else
ship->SetRespawnLoc(obj_kill.GetRespawnLoc());
}
}
// this shouldn't happen in practice,
// but if it does, this is what should be done:
else {
Shot* shot = FindShotByObjID(obj_kill.GetObjID());
if (shot) {
::Print("NetGameClient::DoObjKill destroying shot '%s'\n", shot->Name());
shot->Destroy();
}
}
}