//----------------------------------------------------------------------------
//              
//	ROUTINE:	CAIHumanStrategyShootStream::CalculateStreamTime()
//              
//	PURPOSE:	Calculate how long we should next fire a stream for.
//              
//----------------------------------------------------------------------------
void CAIHumanStrategyShootStream::CalculateStreamTime()
{
	CWeapon* pWeapon = GetAI()->GetCurrentWeapon();

	AIASSERT( pWeapon && pWeapon->GetWeaponData(), m_pAIHuman->GetHOBJECT(), "" );
	if ( !pWeapon || ( pWeapon && !pWeapon->GetWeaponData()) )
	{
		return;
	}

	m_flStreamTime = g_pLTServer->GetTime() + GetRandom(pWeapon->GetWeaponData()->fAIMinBurstInterval, pWeapon->GetWeaponData()->fAIMaxBurstInterval);
}
Exemplo n.º 2
0
LTBOOL CAIHelicopterStrategyShoot::Init(AI_Helicopter* pAIHelicopter)
{
	if ( !CAIHelicopterStrategy::Init(pAIHelicopter) )
	{
        return LTFALSE;
	}

	// For each weapon, setup burst info

	for ( int iWeapon = 0 ; iWeapon < GetAI()->GetNumWeapons() ; iWeapon++ )
	{
		CWeapon* pWeapon = GetAI()->GetWeapon(iWeapon);
		if ( pWeapon )
		{
			m_aBursts[iWeapon].m_bActive = LTTRUE;
			m_aBursts[iWeapon].m_fBurstInterval = 0;
			m_aBursts[iWeapon].m_nBurstShots = GetRandom(pWeapon->GetWeaponData()->nAIMinBurstShots, pWeapon->GetWeaponData()->nAIMaxBurstShots);
		}
		else
		{
			m_aBursts[iWeapon].m_bActive = LTFALSE;
			m_aBursts[iWeapon].m_fBurstInterval = (float)INT_MAX;
			m_aBursts[iWeapon].m_nBurstShots = 0;
		}
	}

    return LTTRUE;
}