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

Method EnterStateTargeting

trinity/Eve/Turret/EveTurretSet.cpp:2954–3011  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Todo --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2952// Todo
2953// --------------------------------------------------------------------------------
2954void EveTurretSet::EnterStateTargeting()
2955{
2956 float animLength = 0.f;
2957 if( !m_isOnline )
2958 {
2959 return;
2960 }
2961
2962 // what state are we in?
2963 switch( m_state )
2964 {
2965 case STATE_DEACTIVE:
2966 // play deplpoy anim, then active loop and fade in tracking
2967 for( unsigned int i = 0; i < m_singleTurrets.size(); ++i )
2968 {
2969 animLength = PlayAnimation( i, "Deploy", "Active", TRACKING_FADE_TIME );
2970 }
2971 // fade in tracking
2972 m_delayToFadeInTracking = animLength + 0.0001f;
2973 break;
2974 case STATE_IDLE:
2975 case STATE_RELOADING:
2976 // fadein tracking, play active loop
2977 m_delayToFadeInTracking = 0.0001f;
2978 for( unsigned int i = 0; i < m_singleTurrets.size(); ++i )
2979 {
2980 PlayAnimation( i, "", "Active", TRACKING_FADE_TIME );
2981 }
2982 break;
2983 case STATE_TARGETING:
2984 break;
2985 case STATE_FIRING:
2986 // stop shooting, then into active loop
2987 m_activeTurret = INVALID_TURRET_INDEX;
2988 m_target->StopFireAtLocator();
2989 if( m_firingEffect )
2990 {
2991 m_firingEffect->StopFiring();
2992 }
2993 for( unsigned int i = 0; i < m_singleTurrets.size(); ++i )
2994 {
2995 PlayAnimation( i, "", "Active", 0.f );
2996 }
2997 break;
2998
2999 default:
3000 break;
3001 }
3002
3003 // finally, we can set state
3004 m_state = STATE_TARGETING;
3005
3006 auto ambientEffect = GetAmbientEffectOrGeneratedEffect();
3007 if( ambientEffect )
3008 {
3009 ambientEffect->SetControllerVariable( "TurretState", float( m_state ) );
3010 }
3011}

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