本文整理汇总了C++中AWeapon::Destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ AWeapon::Destroy方法的具体用法?C++ AWeapon::Destroy怎么用?C++ AWeapon::Destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AWeapon
的用法示例。
在下文中一共展示了AWeapon::Destroy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCollision
void AMainCharacter::OnCollision(AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
AWeapon* CollidedWeapon = Cast<AWeapon>(OtherActor);
if (CollidedWeapon)
{
if (CollidedWeapon->Config.Name == TEXT("Glock") && Inventory[0] == NULL)
{
Inventory[0] = CollidedWeapon->GetClass();
CollidedWeapon->Destroy();
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, "Weapon picked up: " + CollidedWeapon->Config.Name);
}
if (CollidedWeapon->Config.Name == TEXT("M4A1") && Inventory[1] == NULL)
{
Inventory[1] = CollidedWeapon->GetClass();
CollidedWeapon->Destroy();
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, "Weapon picked up: " + CollidedWeapon->Config.Name);
}
if (CollidedWeapon->Config.Name == TEXT("Shotgun") && Inventory[2] == NULL)
{
Inventory[2] = CollidedWeapon->GetClass();
CollidedWeapon->Destroy();
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, "Weapon picked up: " + CollidedWeapon->Config.Name);
}
}
}
示例2: ViZDoom_CheckSlotAmmo
int ViZDoom_CheckSlotAmmo(int slot){
if(vizdoomPlayer->weapons.Slots[slot].Size() <= 0) return 0;
const PClass *typeWeapon = vizdoomPlayer->weapons.Slots[slot].GetWeapon(0);
AWeapon *weapon = (AWeapon*) typeWeapon->CreateNew();
//AWeapon *weapon = (AWeapon*)vizdoomPlayer->mo->FindInventory(type);
if (weapon != NULL){
const PClass *typeAmmo = weapon->AmmoType1;
weapon->Destroy();
return ViZDoom_CheckItem(typeAmmo);
}
else return 0;
}
示例3: Destroy
void AWeapon::Destroy()
{
AWeapon *sister = SisterWeapon;
if (sister != NULL)
{
// avoid recursion
sister->SisterWeapon = NULL;
if (sister != this)
{ // In case we are our own sister, don't crash.
sister->Destroy();
}
}
Super::Destroy();
}
示例4: P_UndoPlayerMorph
bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag, bool force)
{
AWeapon *beastweap;
APlayerPawn *mo;
APlayerPawn *pmo;
angle_t angle;
pmo = player->mo;
// [MH]
// Checks pmo as well; the PowerMorph destroyer will
// try to unmorph the player; if the destroyer runs
// because the level or game is ended while morphed,
// by the time it gets executed the morphed player
// pawn instance may have already been destroyed.
if (pmo == NULL || pmo->tracer == NULL)
{
return false;
}
bool DeliberateUnmorphIsOkay = !!(MORPH_STANDARDUNDOING & unmorphflag);
if ((pmo->flags2 & MF2_INVULNERABLE) // If the player is invulnerable
&& ((player != activator) // and either did not decide to unmorph,
|| (!((player->MorphStyle & MORPH_WHENINVULNERABLE) // or the morph style does not allow it
|| (DeliberateUnmorphIsOkay))))) // (but standard morph styles always allow it),
{ // Then the player is immune to the unmorph.
return false;
}
mo = barrier_cast<APlayerPawn *>(pmo->tracer);
mo->SetOrigin (pmo->Pos(), false);
mo->flags |= MF_SOLID;
pmo->flags &= ~MF_SOLID;
if (!force && !P_TestMobjLocation (mo))
{ // Didn't fit
mo->flags &= ~MF_SOLID;
pmo->flags |= MF_SOLID;
player->morphTics = 2*TICRATE;
return false;
}
pmo->player = NULL;
// Remove the morph power if the morph is being undone prematurely.
for (AInventory *item = pmo->Inventory, *next = NULL; item != NULL; item = next)
{
next = item->Inventory;
if (item->IsKindOf(RUNTIME_CLASS(APowerMorph)))
{
static_cast<APowerMorph *>(item)->SetNoCallUndoMorph();
item->Destroy();
}
}
EndAllPowerupEffects(pmo->Inventory);
mo->ObtainInventory (pmo);
DObject::StaticPointerSubstitution (pmo, mo);
if ((pmo->tid != 0) && (player->MorphStyle & MORPH_NEWTIDBEHAVIOUR))
{
mo->tid = pmo->tid;
mo->AddToHash ();
}
mo->angle = pmo->angle;
mo->player = player;
mo->reactiontime = 18;
mo->flags = ActorFlags::FromInt (pmo->special2) & ~MF_JUSTHIT;
mo->velx = 0;
mo->vely = 0;
player->velx = 0;
player->vely = 0;
mo->velz = pmo->velz;
if (!(pmo->special2 & MF_JUSTHIT))
{
mo->renderflags &= ~RF_INVISIBLE;
}
mo->flags = (mo->flags & ~(MF_SHADOW|MF_NOGRAVITY)) | (pmo->flags & (MF_SHADOW|MF_NOGRAVITY));
mo->flags2 = (mo->flags2 & ~MF2_FLY) | (pmo->flags2 & MF2_FLY);
mo->flags3 = (mo->flags3 & ~MF3_GHOST) | (pmo->flags3 & MF3_GHOST);
mo->Score = pmo->Score;
InitAllPowerupEffects(mo->Inventory);
PClassActor *exit_flash = player->MorphExitFlash;
bool correctweapon = !!(player->MorphStyle & MORPH_LOSEACTUALWEAPON);
bool undobydeathsaves = !!(player->MorphStyle & MORPH_UNDOBYDEATHSAVES);
player->morphTics = 0;
player->MorphedPlayerClass = 0;
player->MorphStyle = 0;
player->MorphExitFlash = NULL;
player->viewheight = mo->ViewHeight;
AInventory *level2 = mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2), true);
if (level2 != NULL)
{
level2->Destroy ();
}
if ((player->health > 0) || undobydeathsaves)
{
player->health = mo->health = mo->SpawnHealth();
}
else // killed when morphed so stay dead
{
//.........这里部分代码省略.........