本文整理汇总了C++中Shot::Destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ Shot::Destroy方法的具体用法?C++ Shot::Destroy怎么用?C++ Shot::Destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shot
的用法示例。
在下文中一共展示了Shot::Destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
NetGameClient::DoObjDamage(NetMsg* msg)
{
if (!msg) return;
NetObjDamage obj_damage;
obj_damage.Unpack(msg->Data());
Ship* ship = FindShipByObjID(obj_damage.GetObjID());
if (ship) {
Sim* sim = Sim::GetSim();
Shot* shot = FindShotByObjID(obj_damage.GetShotID());
const Ship* owner = 0;
const char* owner_name = "[NET]";
ship->InflictNetDamage(obj_damage.GetDamage(), shot);
if (shot && sim) {
if (shot->Owner()) {
owner = shot->Owner();
owner_name = owner->Name();
}
if (shot->IsMissile()) {
SimRegion* region = ship->GetRegion();
float scale = ship->Design()->explosion_scale;
if (scale <= 0)
scale = ship->Design()->scale;
if (owner) {
const ShipDesign* owner_design = owner->Design();
if (owner_design && owner_design->scale < scale)
scale = (float) owner_design->scale;
}
sim->CreateExplosion(shot->Location(), Point(), Explosion::SHOT_BLAST, 20.0f * scale, scale, region);
}
if (!shot->IsBeam()) {
if (owner) {
ShipStats* stats = ShipStats::Find(owner_name);
if (stats) {
if (shot->IsPrimary())
stats->AddGunHit();
else if (shot->Damage() > 0)
stats->AddMissileHit();
}
}
shot->Destroy();
}
}
}
}
示例2: FindShotByObjID
void
NetGameClient::DoWepDestroy(NetMsg* msg)
{
if (!msg) return;
NetWepDestroy destroy;
destroy.Unpack(msg->Data());
Shot* shot = FindShotByObjID(destroy.GetObjID());
if (shot) {
if (shot->IsBeam())
::Print("NetGameClient::DoWepDestroy shot '%s'\n", shot->Name());
shot->Destroy();
}
}