コード例 #1
0
        private void UpdateState()
        {
            ProcessStateLeave(CurrentState.OnLeave);

            CurrentCoroutine?.Stop();

            PreviousState = CurrentState;
            CurrentState  = NextState;
            NextState     = null;

            if (CurrentState == null)
            {
                return;
            }

            ProcessStateEnter(CurrentState.OnEnter);
            CurrentCoroutine = Coroutines.Instance.Start(ProcessStateUpdate(CurrentState.OnUpdate));
        }
コード例 #2
0
        public void Stop()
        {
            if (!HasStarted)
            {
                return;
            }

            NextState = PreviousState = CurrentState = StartState = null;

            if (CurrentCoroutine != null)
            {
                Coroutines.Instance.Remove(CurrentCoroutine);
                CurrentCoroutine.Stop();
                CurrentCoroutine = null;
            }

            HasStarted = IsRunning = false;
        }