예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         State_01 s1 = new State_01();
         fsm.Start(s1.GetType());
     }
 }
예제 #2
0
    // Start is called before the first frame update
    void Start()
    {
        State_01 s1 = new State_01();
        State_02 s2 = new State_02();

        FsmState <FsmDemo>[] fsmStates = new FsmState <FsmDemo>[2] {
            s1, s2
        };
        fsm = GameEntry.Fsm.CreateFsm <FsmDemo>("FSMtest", this, null);
        var states = fsm.GetAllStates();

        foreach (var item in states)
        {
            Debug.LogError(">>> " + item);
        }
        fsm.Start(s1.GetType());
        Debug.LogError("CURRENT :  " + fsm.IsRunning + " NAME: " + fsm.CurrentState);
    }