4 [
Attribute(defvalue:
"3.0",
desc:
"Maximum animation signal phase to be reached within ActionDuration")]
5 protected float m_fEngineTogglePhase;
7 protected SignalsManagerComponent m_SignalManager;
8 protected int m_iStartingSequenceSignal;
9 protected float m_fStartingSequencePhase;
12 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
14 super.Init(pOwnerEntity, pManagerComponent);
16 m_SignalManager = SignalsManagerComponent.Cast(pOwnerEntity.FindComponent(SignalsManagerComponent));
19 m_iStartingSequenceSignal =
m_SignalManager.AddOrFindSignal(
"startingSequence");
22 override bool CanBeShownScript(IEntity user)
28 override void PerformContinuousAction(IEntity pOwnerEntity, IEntity pUserEntity,
float timeSlice)
30 float duration = Math.AbsFloat(GetActionDuration());
33 m_fStartingSequencePhase += m_fEngineTogglePhase * timeSlice / duration;
34 m_fStartingSequencePhase = Math.Min(m_fStartingSequencePhase, m_fEngineTogglePhase);
38 m_fStartingSequencePhase = m_fEngineTogglePhase;
44 m_SignalManager.SetSignalValue(m_iStartingSequenceSignal, m_fStartingSequencePhase);
46 m_SignalManager.SetSignalValue(m_iStartingSequenceSignal, m_fEngineTogglePhase - m_fStartingSequencePhase);
49 if (
float.AlmostEqual(m_fStartingSequencePhase, m_fEngineTogglePhase))
50 SetState(m_bTargetState);
53 override void OnActionStart(IEntity pUserEntity)
56 m_fStartingSequencePhase =
m_SignalManager.GetSignalValue(m_iStartingSequenceSignal);
59 m_iStartingSequenceSignal = m_fEngineTogglePhase - m_fStartingSequencePhase;
63 override void SetState(
bool enable)
65 super.SetState(enable);
71 m_SignalManager.SetSignalValue(m_iStartingSequenceSignal, m_fEngineTogglePhase);