Beispiel #1
0
        private void Awake()
        {
            _machine = StateMachines.Get <StateType>();
            var btn = GetComponent <Button>();

            btn?.onClick.AddListener(Execute);
        }
Beispiel #2
0
 public override void Register(ActiveManager manager)
 {
     base.Register(manager);
     if (Machine == null)
     {
         Machine = StateMachines.Get <StateType>();
     }
     Machine.OnChange += Changed;
 }
Beispiel #3
0
 private void Awake()
 {
     _machine = StateMachines.Get <T>();
     GetComponent <Button>().onClick.AddListener(() =>
     {
         if (popStateInstead)
         {
             _machine.PopState();
         }
         else if (rotateInstead)
         {
             var all     = (T[])Enum.GetValues(typeof(T));
             var current = (int)(object)_machine.State;
             current     = (current + 1) % all.Length;
             _machine.RequestState((T)(object)current, replaceHistory: replaceHistory);
         }
         else
         {
             _machine.RequestState(state, replaceHistory: replaceHistory);
         }
     });
 }
 public void RequestState()
 {
     StateMachines.Get <T>().RequestState(state);
 }