Beispiel #1
0
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	GunMount::StartFiring
//
//	PURPOSE:	Starts the firing state.
//
// ----------------------------------------------------------------------- //
bool GunMount::StartFiring( )
{
	CWeapon* pWeapon = m_Arsenal.GetCurWeapon( );
	if( !pWeapon )
		return false;

	// Play the fire animation if they have it.
	HMODELANIM hAnim = pWeapon->GetFireAni( );
	if( hAnim != INVALID_ANI )
	{
		pWeapon->PlayAnimation( hAnim, true, false );
	}

	// Fire the weapon.
	if( !FireWeapon( ))
	{
		return StartNotFiring( );
	}

	m_eFiringState = eFiring;

	SetNextUpdate( UPDATE_NEXT_FRAME );

	return true;
}
Beispiel #2
0
void GunMount::UpdateFiring( )
{
	SetNextUpdate( UPDATE_NEXT_FRAME );

	// If we're done, then go to post fire.
	if( m_nRoundsToFire == 0 )
	{
		StartPostFiring( );
		return;
	}

	CWeapon* pWeapon = m_Arsenal.GetCurWeapon( );
	if( !pWeapon )
	{
		StartPostFiring( );
		return;
	}

	// Check if we had a fire anim to go off of.
	HMODELANIM hAnim = pWeapon->GetFireAni( );
	if( hAnim != INVALID_ANI )
	{
		// Check if we're still finishing the fire animation.
		if( !IsAnimationComplete( ))
			return;

		// Start it up for the next fire.
		pWeapon->PlayAnimation( hAnim, true, false );
	}

	// Continue to fire weapon.
	if( !FireWeapon( ))
	{
		StartPostFiring( );
		return;
	}
}