Пример #1
0
        protected virtual void SetSubStateMachine(SubStateMachine ssm, bool entryToStateMachine)
        {
            currentSubStateMachine?.Exit();
            currentSubStateMachine = ssm;
            currentSubStateMachine?.Enter();

            if (entryToStateMachine)
            {
                SetState(currentSubStateMachine.entryState);
            }
        }
Пример #2
0
        // Exit FSM, exit current state and stop Update Coroutine
        public virtual void ExitFSM()
        {
            if (fsmCoroutine == null)
            {
                Debug.LogError($"FSM is not running! Can't exit if it's not active.");
                return;
            }

            currentState?.Exit();

            currentSubStateMachine = null;
            currentState           = null;

            StopCoroutine(fsmCoroutine);
            fsmCoroutine = null;
        }