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

Method EnterStateDeactive

trinity/Eve/Turret/EveTurretSet.cpp:2836–2883  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Exposed function to put this turret set into the deactive state. Depending on the current state we trigger different anims, wait times. etc. --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2834// on the current state we trigger different anims, wait times. etc.
2835// --------------------------------------------------------------------------------
2836void EveTurretSet::EnterStateDeactive()
2837{
2838 // what state are we in?
2839 switch( m_state )
2840 {
2841 case STATE_DEACTIVE:
2842 // do nothing if we are already in this state
2843 break;
2844 case STATE_IDLE:
2845 case STATE_RELOADING:
2846 // no fadeout of tracking, just play deactive anim and then the deactive loop
2847 m_trackingInfluence = 0.f;
2848 for( unsigned int i = 0; i < m_singleTurrets.size(); ++i )
2849 {
2850 PlayAnimation( i, "Pack", "Inactive" );
2851 m_delayToFadeOutTracking = 0.f;
2852 }
2853 break;
2854 case STATE_FIRING:
2855 // stop shooting
2856 if( m_firingEffect )
2857 {
2858 m_firingEffect->StopFiring();
2859 }
2860 // DON'T break, just continue with stopping things:
2861 case STATE_TARGETING:
2862 // fadeout the tracking, play deactive anim and then the deactive loop
2863 m_delayToFadeOutTracking = 0.0001f;
2864 m_activeTurret = INVALID_TURRET_INDEX;
2865 m_target->StopFireAtLocator();
2866 for( unsigned int i = 0; i < m_singleTurrets.size(); ++i )
2867 {
2868 PlayAnimation( i, "Pack", "Inactive", TRACKING_FADE_TIME );
2869 }
2870 break;
2871
2872 default:
2873 break;
2874 }
2875 // finally, we can set state
2876 m_state = STATE_DEACTIVE;
2877
2878 auto ambientEffect = GetAmbientEffectOrGeneratedEffect();
2879 if( ambientEffect )
2880 {
2881 ambientEffect->SetControllerVariable( "TurretState", float( m_state ) );
2882 }
2883}
2884
2885// --------------------------------------------------------------------------------
2886// 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