Exemplo n.º 1
0
 public void EnterDefaultState()
 {
     if (_stateHandler != null)
     {
         _stateHandler.EnterState(DefaultState);
     }
 }
Exemplo n.º 2
0
        public override IEnumerator Corutine(params object[] data)
        {
            StateHandler handler          = SelectObjectForData <StateHandler>(data);
            Type         currentStateType = handler.CurrentStateInterfaceHandler.CurrentState.GetType();
            IState       newState         = stateInfo.GetInstance();

            handler.EnterState(newState);
            string[] typeNamesParts = newState.GetType().ToString().Split('.');
            string   stateTypeName  = typeNamesParts[typeNamesParts.Length - 1];

            Debug.LogFormat("Object {0} enter {1}.", handler.gameObject.name, stateTypeName);
            yield return(new WaitUntil(() =>
            {
                return handler.CurrentStateInterfaceHandler == null || handler.CurrentStateInterfaceHandler.CurrentState.GetType() == currentStateType;
            }));

            Debug.LogFormat("Object {0} exit {1}.", handler.gameObject.name, stateTypeName);
        }
Exemplo n.º 3
0
 private void Start()
 {
     _stateHandler.EnterState(Graph.RootState);
 }