예제 #1
0
        protected void EndDialog()
        {
            CurrentHandler?.End();
            CurrentHandler = null;
            CurrentState   = null;

            CurrentDialog.OnDialogEnd.Invoke();
            CurrentDialog.CleanUp();
            CurrentDialog = null;
        }
예제 #2
0
        public void SwitchState(DialogState state)
        {
            if (state == null)
            {
                Debug.LogError("Theres no state to switch to", CurrentState);
                Exit();
            }

            NextState = state;
        }
예제 #3
0
        protected override void OnTick()
        {
            if (IsExiting)
            {
                ReturnToPreviousState();
                return;
            }

            if (NextState)
            {
                CurrentHandler?.End();
                CurrentHandler = null;

                var handler = AllHandlers.FirstOrDefault(h => h.Supports(NextState));
                if (handler != null)
                {
                    CurrentState   = NextState;
                    CurrentHandler = handler;
                    NextState      = null;

                    CurrentHandler.Begin();
                }
                else
                {
                    Debug.LogError("Unable to handle state", CurrentState);
                    ReturnToPreviousState();
                }
            }
            else
            {
                if (CurrentHandler != null)
                {
                    CurrentHandler.Tick();
                }
            }
        }
예제 #4
0
 public override bool Supports(DialogState state)
 {
     return(state is TState);
 }
예제 #5
0
 public abstract bool Supports(DialogState state);