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

Method EnterStateReloading

trinity/Eve/Turret/EveTurretSet.cpp:3175–3219  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Exposed function to put this turret set into the reloading state. It will play the reloading animation follow then by idle --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

3173// play the reloading animation follow then by idle
3174// --------------------------------------------------------------------------------
3175void EveTurretSet::EnterStateReloading()
3176{
3177 // what state are we in?
3178 switch( m_state )
3179 {
3180 case STATE_DEACTIVE:
3181 // ingnore this state change: when the turret is inactive, no reload state can be shown!
3182 break;
3183 case STATE_INVALID:
3184 case STATE_IDLE:
3185 case STATE_RELOADING:
3186 // just play reloading anim and then loop
3187 for( unsigned int i = 0; i < m_singleTurrets.size(); ++i )
3188 {
3189 PlayAnimation( i, "Reload", "Active", 0.f );
3190 }
3191 break;
3192 case STATE_TARGETING:
3193 case STATE_FIRING:
3194 // stop shooting, fadout tracking, then into active loop
3195 m_delayToFadeOutTracking = 0.0001f;
3196 m_activeTurret = INVALID_TURRET_INDEX;
3197 m_target->StopFireAtLocator();
3198 if( m_firingEffect )
3199 {
3200 m_firingEffect->StopFiring();
3201 }
3202 for( unsigned int i = 0; i < m_singleTurrets.size(); ++i )
3203 {
3204 PlayAnimation( i, "Reload", "Active", TRACKING_FADE_TIME );
3205 }
3206 break;
3207
3208 default:
3209 break;
3210 }
3211 // finally, we can set state
3212 m_state = STATE_RELOADING;
3213
3214 auto ambientEffect = GetAmbientEffectOrGeneratedEffect();
3215 if( ambientEffect )
3216 {
3217 ambientEffect->SetControllerVariable( "TurretState", float( m_state ) );
3218 }
3219}
3220
3221// --------------------------------------------------------------------------------
3222// Description:

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.80
StopFireAtLocatorMethod · 0.80
StopFiringMethod · 0.45
SetControllerVariableMethod · 0.45

Tested by

no test coverage detected