MCPcopy Create free account
hub / github.com/carbonengine/trinity / EnterStateFiring

Method EnterStateFiring

trinity/Eve/Turret/EveTurretSet.cpp:3019–3059  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Exposed function to put this turret set into the firing state. It will start playing the fireanim and then go into standard active loop until this function is called again. --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

3017// this function is called again.
3018// --------------------------------------------------------------------------------
3019void EveTurretSet::EnterStateFiring()
3020{
3021 if( !SetupFiringState() )
3022 {
3023 return;
3024 }
3025
3026 // only if we are in firing mode, call ::StopFiring() on the effect right before
3027 // we call ::PrepareFiring(), it'll clean things up in the effect
3028 if( m_firingEffect && m_state == STATE_FIRING )
3029 {
3030 if( m_firingEffect->IsLooping() )
3031 {
3032 // We don't want to start and stop the curves when the turret is looping and firing
3033 m_firingEffect->PrepareFiringEffectMoveObjects();
3034 return;
3035 }
3036 m_firingEffect->StopFiring();
3037 }
3038
3039 // We're starting a firing sequence, we need to set up our firing effect time-delays
3040 if( m_firingEffect )
3041 {
3042 if( m_maxCyclingFirePos > 1 )
3043 {
3044 m_firingEffect->PrepareFiring( m_randomFiringDelay, m_currentCyclingFiresPos, m_cyclingFireGroupCount );
3045 }
3046 else
3047 {
3048 m_firingEffect->PrepareFiring( m_randomFiringDelay );
3049 }
3050
3051 if( m_target != nullptr )
3052 {
3053 m_firingEffect->SetImpactConfiguration( m_target->GetImpactConfiguration() );
3054 }
3055 }
3056
3057 // finally, we can set state
3058 m_state = STATE_FIRING;
3059}
3060
3061
3062// --------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 6

IsLoopingMethod · 0.80
PrepareFiringMethod · 0.80
StopFiringMethod · 0.45

Tested by

no test coverage detected