本文整理汇总了C++中IsAlive函数的典型用法代码示例。如果您正苦于以下问题:C++ IsAlive函数的具体用法?C++ IsAlive怎么用?C++ IsAlive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsAlive函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void Totem::Update(uint32 time)
{
if (!GetOwner()->IsAlive() || !IsAlive())
{
UnSummon(); // remove self
return;
}
if (m_duration <= time)
{
UnSummon(); // remove self
return;
}
else
m_duration -= time;
Creature::Update(time);
}
示例2: SpawnParticle
void SpawnerParticle::SpawnParticle() {
if (particles != NULL && IsAlive()) {
Vector2 pos((float)(rand() % this->width), (float)(rand() % this->height));
pos += this->position - Vector2(this->width / 2.0f, this->height / 2.0f);
Color color(this->color.Hue, 1.0f, 1.0f);
float size = rand() % 4 + 4.0f; // Give a varied size
if (rand() % 100 == 0) // 1% chance of an even bigger particle
size += 12.0f;
Vector2 initialSpeed = Vector2(0.0f, 20.0f); // Particles have some initial speed
Vector2 force = Vector2(0.0f, 15.0f); // Particles move downwards
Particle *p = new Particle(pos, color, size, initialSpeed, force);
particles->Add(p);
}
}
示例3: ShouldDraw
bool C_CFPlayer::ShouldDraw( void )
{
// If we're dead, our ragdoll will be drawn for us instead.
if ( !IsAlive() && !IsKnockedOut() )
return false;
if( GetTeamNumber() == TEAM_SPECTATOR )
return false;
if( IsLocalPlayer() && IsRagdoll() )
return true;
if (m_hCameraCinematic != NULL)
return false;
// Skip C_BasePlayer::ShouldDraw() because it has a bunch of logic we don't care for.
return C_BaseCombatCharacter::ShouldDraw();
}
示例4: TakeDamage
int CMTalkMonster :: TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType)
{
if ( IsAlive() )
{
// if player damaged this entity, have other friends talk about it
if (pevAttacker && m_MonsterState != MONSTERSTATE_PRONE && FBitSet(pevAttacker->flags, FL_CLIENT))
{
edict_t *pFriend = FindNearestFriend(FALSE);
if (pFriend && UTIL_IsAlive(pFriend))
{
// only if not dead or dying!
CMTalkMonster *pTalkMonster = (CMTalkMonster *)pFriend;
pTalkMonster->ChangeSchedule( slIdleStopShooting );
}
}
}
return CMBaseMonster::TakeDamage(pevInflictor, pevAttacker, flDamage, bitsDamageType);
}
示例5: ToggleAttackContinous
bool CPlayerMySelf::ToggleAttackContinous()
{
if(!IsAlive()) return false;
if(false == m_bAttackContinous) // 타겟이 있는지 본다..
{
CPlayerNPC* pTarget = s_pOPMgr->CharacterGetByID(m_iIDTarget, true);
if(pTarget) // && !IsOutOfAttackRange(pTarget)) // 타겟이 있고 공격 가능한 범위에 있을때만
{
this->m_bAttackContinous = true;
}
}
else
{
m_bAttackContinous = false;
}
return m_bAttackContinous;
}
示例6: GetAbsOrigin
void CZombie::OnTakeDamage( const CTakeDamageInfo& info )
{
CTakeDamageInfo newInfo = info;
// Take 30% damage from bullets
if ( newInfo.GetDamageTypes() == DMG_BULLET )
{
Vector vecDir = GetAbsOrigin() - ( newInfo.GetInflictor()->pev->absmin + newInfo.GetInflictor()->pev->absmax) * 0.5;
vecDir = vecDir.Normalize();
float flForce = DamageForce( newInfo.GetDamage() );
pev->velocity = pev->velocity + vecDir * flForce;
newInfo.GetMutableDamage() *= 0.3;
}
// HACK HACK -- until we fix this.
if ( IsAlive() )
PainSound();
CBaseMonster::OnTakeDamage( newInfo );
}
示例7: SetAlive
/*
* Sets the states for particles
*
* @author Michael McQuarrie
*
* @return void
*/
bool
CFlagParticleEmitter::CheckAlive()
{
for(std::vector<TParticle>::iterator iter = m_vecParticles.begin();
iter != m_vecParticles.end(); ++iter)
{
if(iter->bAlive)
{
SetAlive(true);
break;
}
else
{
SetAlive(false);
}
}
return(IsAlive());
}
示例8: FindNearestFriend
void CTalkMonster::OnTakeDamage( const CTakeDamageInfo& info )
{
if ( IsAlive() )
{
// if player damaged this entity, have other friends talk about it
if (info.GetAttacker() && m_MonsterState != MONSTERSTATE_PRONE && info.GetAttacker()->GetFlags().Any( FL_CLIENT ) )
{
CBaseEntity *pFriend = FindNearestFriend( false );
if (pFriend && pFriend->IsAlive())
{
// only if not dead or dying!
CTalkMonster *pTalkMonster = (CTalkMonster *)pFriend;
pTalkMonster->ChangeSchedule( slIdleStopShooting );
}
}
}
CBaseMonster::OnTakeDamage( info );
}
示例9: Vector
void CZombie::FrozenStart()
{
if ( GetTask()->iTask == TASK_AWAKE_FROM_DEAD )
return;
m_fEndfrozen = gpGlobals->time + FREEZE_DURATION;
pev->renderfx = kRenderFxGlowShell;
pev->rendercolor = Vector(0,90,250);
Create( "fx_spawner_freeze", pev->origin, pev->origin, edict());
if (IsAlive())
{
pev->sequence = 0;
pev->framerate = 0;
m_MonsterState = MONSTERSTATE_IDLE;
Stop();
}
pev->velocity = pev->avelocity = g_vecZero;
}
示例10: GetOwner
void Totem::Update(uint32 update_diff, uint32 time)
{
Unit* owner = GetOwner();
if (!owner || !owner->IsAlive() || !IsAlive())
{
UnSummon(); // remove self
return;
}
if (m_duration <= update_diff)
{
UnSummon(); // remove self
return;
}
else
{ m_duration -= update_diff; }
Creature::Update(update_diff, time);
}
示例11: SendObjectDeSpawnAnim
void Totem::UnSummon()
{
SendObjectDeSpawnAnim(GetGUID());
CombatStop();
RemoveAurasDueToSpell(GetSpell());
// clear owner's totem slot
for (int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
{
if (m_owner->m_SummonSlot[i] == GetGUID())
{
m_owner->m_SummonSlot[i] = 0;
break;
}
}
m_owner->RemoveAurasDueToSpell(GetSpell());
//remove aura all party members too
Group* pGroup = NULL;
if (m_owner->GetTypeId() == TYPEID_PLAYER)
{
// Not only the player can summon the totem (scripted AI)
pGroup = m_owner->ToPlayer()->GetGroup();
if (pGroup)
{
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* Target = itr->GetSource();
if (Target && pGroup->SameSubGroup(m_owner->ToPlayer(), Target))
Target->RemoveAurasDueToSpell(GetSpell());
}
}
}
// any totem unsummon look like as totem kill, req. for proper animation
if (IsAlive())
setDeathState(DEAD);
AddObjectToRemoveList();
}
示例12: PostThink
void CEntHost::PostThink()
{
m_bIsBot = (GetBotController()) ? true : false;
if ( IsAlive() && IsActive() ) {
UpdateComponents();
UpdateAttributes();
m_bOnCombat = (m_CombatTimer.HasStarted() && m_CombatTimer.IsLessThen( 10.0f ));
m_bUnderAttack = (m_UnderAttackTimer.HasStarted() && m_UnderAttackTimer.IsLessThen( 5.0f ));
if ( m_bIsBot && !m_bOnCombat ) {
m_bOnCombat = GetBotController()->IsAlerted() || GetBotController()->IsCombating();
}
}
if ( GetAnimationSystem() ) {
GetAnimationSystem()->Update();
}
}
示例13: switch
void isdf07Mission::SendEnemies(int type, Handle target) {
switch (type) {
case 0: //tank
if (!IsAlive(enemy1)) {
enemy1 = BuildObject("fvtank", comp_team, spawn1);
Attack(enemy1, target, 1);
}
break;
case 1: //rocket
if (!IsAlive(enemy1)) {
enemy1 = BuildObject("fvsent", comp_team, spawn1);
Attack(enemy1, target, 1);
}
if (!IsAlive(enemy2)) {
enemy2 = BuildObject("fvsent", comp_team, spawn2);
Attack(enemy2, target, 1);
}
break;
case 2: //constructor
if (!IsAlive(enemy1)) {
enemy1 = BuildObject("fvtank", comp_team, spawn1);
Attack(enemy1, target, 1);
}
break;
case 3: //turret
if (!IsAlive(enemy1)) {
enemy1 = BuildObject("fvarch", 2, spawn1);
Attack(enemy1, target, 1);
}
if (!IsAlive(enemy2)) {
enemy2 = BuildObject("fvarch", 2, spawn2);
Attack(enemy2, target, 1);
}
break;
case 4: //gun tower
SetIndependence(enemy1, 0);
SetIndependence(enemy2, 0);
enemy1 = BuildObject("fvtank", 2, spawn1);
enemy2 = BuildObject("fvtank", 2, spawn2);
enemy3 = BuildObject("fvsent", 2, spawn3);
Attack(enemy1, target, 1);
Attack(enemy2, target, 1);
Defend2(enemy3, enemy1, 1);
break;
}
// so we transform them later
enemy1deployed=false;
enemy2deployed=false;
}
示例14: FireWeapon
bool Unit::FireWeapon(GameObject* Target)
{
if (!IsAlive())
return false;
if ( gCurrentWeapon )
{
if (gWeaponState == Aim && !PlayingAnimation(GetAnimation("Draw")))
{
if (gCurrentWeapon->Fire( this, Target, gMultipliers[1] ))
{
PlayAnimation(GetAnimation("Shoot"));
PlayAnimationAfter(GetAnimation("Shoot"), GetAnimation("Aim"));
return true;
}
}
}
return false;
}
示例15: while
Actor* Game::GetPC(unsigned int slot, bool onlyalive)
{
if (slot >= PCs.size()) {
return NULL;
}
if (onlyalive) {
unsigned int i=0;
while(i<PCs.size() ) {
Actor *ac = PCs[i++];
if (IsAlive(ac) ) {
if (!slot--) {
return ac;
}
}
}
return NULL;
}
return PCs[slot];
}