本文整理汇总了C++中IsAlive函数的典型用法代码示例。如果您正苦于以下问题:C++ IsAlive函数的具体用法?C++ IsAlive怎么用?C++ IsAlive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsAlive函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:090809,项目名称:TrinityCore,代码行数:18,代码来源:Totem.cpp
示例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);
}
}
开发者ID:horsedrowner,项目名称:Fireworks,代码行数:18,代码来源:Particle.cpp
示例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();
}
开发者ID:BSVino,项目名称:Arcon,代码行数:18,代码来源:c_cf_player.cpp
示例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);
}
开发者ID:ET-NiK,项目名称:amxxgroup,代码行数:19,代码来源:talkmonster.cpp
示例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;
}
开发者ID:sailei1,项目名称:knightonline,代码行数:19,代码来源:PlayerMySelf.cpp
示例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 );
}
开发者ID:swmpdg,项目名称:HLEnhanced,代码行数:19,代码来源:CZombie.cpp
示例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());
}
开发者ID:DrBiologicals,项目名称:Total-Cube-Domination,代码行数:26,代码来源:flagparticleemitter.cpp
示例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 );
}
开发者ID:oskarlh,项目名称:HLEnhanced,代码行数:19,代码来源:CTalkMonster.cpp
示例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;
}
开发者ID:mittorn,项目名称:hlwe_src,代码行数:19,代码来源:mon_zombie.cpp
示例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);
}
开发者ID:lucasdnd,项目名称:mangoszero-bots-test,代码行数:19,代码来源:Totem.cpp
示例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();
}
开发者ID:Adeer,项目名称:OregonCore,代码行数:42,代码来源:Totem.cpp
示例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();
}
}
开发者ID:WootsMX,项目名称:InSource,代码行数:20,代码来源:ent_host.cpp
示例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;
}
开发者ID:Nielk1,项目名称:bz2-sp-fixes,代码行数:49,代码来源:isdf07.cpp
示例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;
}
开发者ID:CarlRapp,项目名称:CodenameGamma,代码行数:20,代码来源:Unit.cpp
示例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];
}
开发者ID:BlackLotus,项目名称:gemrb,代码行数:20,代码来源:Game.cpp
示例16: Ignite
//---------------------------------------------------------
// Zombies should scream continuously while burning, so long
// as they are alive... but NOT IN GERMANY!
//---------------------------------------------------------
void CRebelZombie::Ignite( float flFlameLifetime, bool bNPCOnly, float flSize, bool bCalledByLevelDesigner )
{
if( !IsOnFire() && IsAlive() )
{
BaseClass::Ignite( flFlameLifetime, bNPCOnly, flSize, bCalledByLevelDesigner );
if ( !UTIL_IsLowViolence() )
{
RemoveSpawnFlags( SF_NPC_GAG );
MoanSound( envRebelZombieMoanIgnited, ARRAYSIZE( envRebelZombieMoanIgnited ) );
if ( m_pMoanSound )
{
ENVELOPE_CONTROLLER.SoundChangePitch( m_pMoanSound, 120, 1.0 );
ENVELOPE_CONTROLLER.SoundChangeVolume( m_pMoanSound, 1, 1.0 );
}
}
}
}
开发者ID:KyleGospo,项目名称:City-17-Episode-One-Source,代码行数:24,代码来源:npc_rebelzombie.cpp
示例17: TraceAttack
void CNPC_Gargantua::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr )
{
CTakeDamageInfo subInfo = info;
if ( !IsAlive() )
{
BaseClass::TraceAttack( subInfo, vecDir, ptr );
return;
}
// UNDONE: Hit group specific damage?
if ( subInfo.GetDamageType() & ( GARG_DAMAGE | DMG_BLAST ) )
{
if ( m_painSoundTime < gpGlobals->curtime )
{
CPASAttenuationFilter filter( this );
EmitSound( filter, entindex(), "Garg.Pain" );
m_painSoundTime = gpGlobals->curtime + random->RandomFloat( 2.5, 4 );
}
}
int bitsDamageType = subInfo.GetDamageType();
bitsDamageType &= GARG_DAMAGE;
subInfo.SetDamageType( bitsDamageType );
if ( subInfo.GetDamageType() == 0 )
{
if ( m_flDmgTime != gpGlobals->curtime || (random->RandomInt( 0, 100 ) < 20) )
{
g_pEffects->Ricochet(ptr->endpos, -vecDir );
m_flDmgTime = gpGlobals->curtime;
}
subInfo.SetDamage( 0 );
}
BaseClass::TraceAttack( subInfo, vecDir, ptr );
}
开发者ID:hitmen047,项目名称:TF2HLCoop,代码行数:41,代码来源:hl1_npc_gargantua.cpp
示例18: RunAI
//=========================================================
// RunAI
//=========================================================
void CNPC_Controller::RunAI( void )
{
BaseClass::RunAI();
Vector vecStart;
QAngle angleGun;
//some kind of hack in hl1 ?
// if ( HasMemory( bits_MEMORY_KILLED ) )
//use this instead
if( !IsAlive() )
return;
for (int i = 0; i < 2; i++)
{
if (m_pBall[i] == NULL)
{
m_pBall[i] = CSprite::SpriteCreate( "sprites/xspark4.vmt", GetAbsOrigin(), TRUE );
m_pBall[i]->SetTransparency( kRenderGlow, 255, 255, 255, 255, kRenderFxNoDissipation );
m_pBall[i]->SetAttachment( this, (i + 3) );
m_pBall[i]->SetScale( 1.0 );
}
float t = m_iBallTime[i] - gpGlobals->curtime;
if (t > 0.1)
t = 0.1 / t;
else
t = 1.0;
m_iBallCurrent[i] += (m_iBall[i] - m_iBallCurrent[i]) * t;
m_pBall[i]->SetBrightness( m_iBallCurrent[i] );
GetAttachment( i + 2, vecStart, angleGun );
m_pBall[i]->SetAbsOrigin( vecStart );
CBroadcastRecipientFilter filter;
GetAttachment( i + 3, vecStart, angleGun );
te->DynamicLight( filter, 0.0, &vecStart, 255, 192, 64, 0/*exponent*/, m_iBallCurrent[i] / 8 /*radius*/, 0.5, 0 );
}
}
开发者ID:AgentAgrimar,项目名称:source-sdk-trilogy,代码行数:44,代码来源:hl1_npc_controller.cpp
示例19: Cleanup
void WinProcessImpl::Cleanup()
{
// Under windows, the reader thread is detached
if ( m_thr ) {
// Stop the reader thread
m_thr->Stop();
delete m_thr;
}
m_thr = NULL;
// terminate the process
if (IsAlive()) {
std::map<unsigned long, bool> tree;
ProcUtils::GetProcTree(tree, GetPid());
std::map<unsigned long, bool>::iterator iter = tree.begin();
for(; iter != tree.end(); iter++) {
wxKillError rc;
wxKill(iter->first, wxSIGKILL, &rc);
}
TerminateProcess(piProcInfo.hProcess, 255);
}
CloseHandle( hChildStdinRd);
CloseHandle( hChildStdinWrDup );
CloseHandle( hChildStdoutWr);
CloseHandle( hChildStdoutRdDup );
CloseHandle( hChildStderrWr);
CloseHandle( hChildStderrRdDup );
CloseHandle( piProcInfo.hProcess );
CloseHandle( piProcInfo.hThread );
hChildStdinRd = NULL;
hChildStdoutWr = NULL;
hChildStdinWrDup = NULL;
hChildStdoutRdDup = NULL;
hChildStderrWr = NULL;
hChildStderrRdDup = NULL;
piProcInfo.hProcess = NULL;
piProcInfo.hThread = NULL;
}
开发者ID:Bloodknight,项目名称:codelite,代码行数:41,代码来源:winprocess_impl.cpp
示例20: OnTakeDamage_Alive
int CNPC_Gargantua::OnTakeDamage_Alive( const CTakeDamageInfo &info )
{
CTakeDamageInfo subInfo = info;
float flDamage = subInfo.GetDamage();
if ( IsAlive() )
{
if ( !(subInfo.GetDamageType() & GARG_DAMAGE) )
{
flDamage *= 0.01;
subInfo.SetDamage( flDamage );
}
if ( subInfo.GetDamageType() & DMG_BLAST )
{
SetCondition( COND_LIGHT_DAMAGE );
}
}
return BaseClass::OnTakeDamage_Alive( subInfo );
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:21,代码来源:hl1_npc_gargantua.cpp
注:本文中的IsAlive函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论