本文整理汇总了C++中CCharacter::GetLastSpawn方法的典型用法代码示例。如果您正苦于以下问题:C++ CCharacter::GetLastSpawn方法的具体用法?C++ CCharacter::GetLastSpawn怎么用?C++ CCharacter::GetLastSpawn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCharacter
的用法示例。
在下文中一共展示了CCharacter::GetLastSpawn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Tick
void CTurret::Tick()
{
CCharacter *OwnerChar = GameServer()->GetPlayerChar(m_Owner);
if(OwnerChar && !OwnerChar->IsAlive())
{
Reset();
return;
}
if((Server()->Tick() - m_EvalTick) / Server()->TickSpeed() < 10) //let the turret live for 90 seconds
{
if((Server()->Tick() - m_LastFire) / Server()->TickSpeed() > 0)
{
CCharacter *pChr = GameServer()->m_World.ClosestCharacter(m_Pos, 16.0f, 0);
if(pChr && pChr->IsAlive() && pChr->GetPlayer()->GetCID() != m_Owner)
{
pChr->TakeDamage(vec2(0.f, 0.f), 15, m_Owner, WEAPON_RIFLE);
GameServer()->CreateSound(m_Pos, SOUND_RIFLE_FIRE);
Reset();
}
else
{
pChr = GameServer()->m_World.ClosestCharacter(m_Pos, 182.0f, 0);
if(pChr && pChr->IsAlive() && pChr != OwnerChar && ((Server()->Tick() - pChr->GetLastSpawn()) / Server()->TickSpeed() > 1))
{
vec2 targetDirection = normalize(pChr->m_Pos - m_Pos);
new CLaser(GameWorld(), m_Pos, targetDirection, GameServer()->Tuning()->m_LaserReach, m_Owner);
GameServer()->CreateSound(m_Pos, SOUND_RIFLE_FIRE);
m_LastFire = Server()->Tick();
}
}
}
}
else
{
Reset();
if(OwnerChar && OwnerChar->IsAlive() && OwnerChar->GetPlayer()->m_TurretsCreated > 0)
OwnerChar->GetPlayer()->m_TurretsCreated --;
}
}