本文整理汇总了C++中AWeapon::BecomeItem方法的典型用法代码示例。如果您正苦于以下问题:C++ AWeapon::BecomeItem方法的具体用法?C++ AWeapon::BecomeItem怎么用?C++ AWeapon::BecomeItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AWeapon
的用法示例。
在下文中一共展示了AWeapon::BecomeItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TryPickup
bool AWeaponGiver::TryPickup(AActor *&toucher)
{
DDropItem *di = GetDropItems();
AWeapon *weap;
if (di != NULL)
{
PClassWeapon *ti = dyn_cast<PClassWeapon>(PClass::FindClass(di->Name));
if (ti != NULL)
{
if (master == NULL)
{
master = weap = static_cast<AWeapon*>(Spawn(di->Name));
if (weap != NULL)
{
weap->ItemFlags &= ~IF_ALWAYSPICKUP; // use the flag of this item only.
weap->flags = (weap->flags & ~MF_DROPPED) | (this->flags & MF_DROPPED);
// If our ammo gives are non-negative, transfer them to the real weapon.
if (AmmoGive1 >= 0) weap->AmmoGive1 = AmmoGive1;
if (AmmoGive2 >= 0) weap->AmmoGive2 = AmmoGive2;
// If DropAmmoFactor is non-negative, modify the given ammo amounts.
if (DropAmmoFactor > 0)
{
weap->AmmoGive1 = int(weap->AmmoGive1 * DropAmmoFactor);
weap->AmmoGive2 = int(weap->AmmoGive2 * DropAmmoFactor);
}
weap->BecomeItem();
}
else return false;
}
weap = barrier_cast<AWeapon*>(master);
bool res = weap->CallTryPickup(toucher);
if (res)
{
GoAwayAndDie();
master = NULL;
}
return res;
}
}
return false;
}