Example #1
0
    // Use this for initialization
    void Start()
    {
        mFSM = new FSM();
        FSM.State state = mFSM.AddState("A");
        state.SetEnterMethod(delegate() { Debug.Log("Enter A " + a); });
        state.SetTickMethod(delegate(float dt) { });
        state.SetExitMethod(delegate() { Debug.Log("Exit A " + a); });

        state = mFSM.AddState("B");
        state.SetEnterMethod(delegate() { Debug.Log("Enter B" + a); });
        state.SetTickMethod(delegate(float dt) { });
        state.SetExitMethod(delegate() { Debug.Log("Exit B " + a); });

        mFSM.addTransition("A", "B", "!(A2B1 & (A2B1 | A2B2)) & !OK");
        mFSM.addTransition("B", "A", "(B2A | B2A)");

        mFSM.Begin();

        InvokeRepeating("Test", 3.0f, 6.0f);
    }