Пример #1
0
    // Examine transitions leading out from the current state
    // If a condition is activated, change the current state and
    // take all the actions linked to:
    // 1. Exit from the current state
    // 2. The activated transition
    // 3. Enter to the new state
    // If no transition is activated, take the actions associated
    // to staying in the current state

    public void Update()       // NOTE: this is NOT a MonoBehaviour
    {
        FSMTransition transition = current.VerifyTransitions();

        if (transition != null)
        {
            current.Exit();
            transition.Fire();
            current = current.NextState(transition);
            current.Enter();
        }
        else
        {
            current.Stay();
        }
    }
Пример #2
0
    public void Update()
    {
        FSMTransition transition = current.VerifyTransitions();

        if (transition != null)
        {
            current.Exit();
            transition.Fire();
            current = current.NextState(transition);
            current.Enter();
        }
        else
        {
            current.Stay();
        }
    }