Example #1
0
            private static IEnumerator DoStateThenGoTo(StateMachine stateMachine, TimelineStateRef TimelineState, TimelineStateRef goToState)
            {
                yield return(stateMachine.StartCoroutine(TimelineStateMachine.Run(stateMachine, TimelineState)));

                stateMachine.GoToState(TimelineStateMachine.Run(stateMachine, goToState));

                yield break;
            }
            public eEventTriggerReturn Update(StateMachine stateMachine, float eventTime)
            {
                if (_condition.IsConditionMet(stateMachine))
                {
                    stateMachine.GoToState(TimelineStateMachine.Run(stateMachine, _state));
                    return(eEventTriggerReturn.EventFinishedExitState);
                }

                return(eEventTriggerReturn.EventOngoing);
            }
Example #3
0
            public eEventTriggerReturn Trigger(StateMachine stateMachine)
            {
                switch (_stateType)
                {
                case eStateType.Coroutine:
                {
                    stateMachine.GoToState(_coroutine.RunCoroutine());
                }
                break;

                case eStateType.Timeline:
                {
                    stateMachine.GoToState(TimelineStateMachine.Run(stateMachine, _state));
                }
                break;
                }

                return(eEventTriggerReturn.EventFinishedExitState);
            }
            public eEventTriggerReturn Trigger(StateMachine stateMachine)
            {
                eEventTriggerReturn ret = eEventTriggerReturn.EventFinished;

                if (_condition != null)
                {
                    _condition.OnStartConditionChecking(stateMachine);

                    if (_condition.IsConditionMet(stateMachine))
                    {
                        stateMachine.GoToState(TimelineStateMachine.Run(stateMachine, _state));
                        ret = eEventTriggerReturn.EventFinishedExitState;
                    }
                    if (_duration > 0.0f)
                    {
                        ret = eEventTriggerReturn.EventOngoing;
                    }
                }

                return(ret);
            }
Example #5
0
 public IEnumerator GetGoToState(StateMachine stateMachine)
 {
     return(TimelineStateMachine.Run(stateMachine, _goToState));
 }
            void Start()
            {
                StateMachine stateMachine = GetComponent <StateMachine>();

                stateMachine.GoToState(TimelineStateMachine.Run(stateMachine, _initialState));
            }