Esempio n. 1
0
    /// <summary>
    /// Checks whether the state should transition to another.
    /// </summary>
    /// <returns>
    /// The next state if able to do a transition, otherwise <c>null</c>
    /// </returns>
    public virtual FSMState OnCondition()
    {
        for (int i = 0; i < _transitions.Count; i++)
        {
            FSMTransition transition = _transitions[i];

            if (transition.Check())
            {
                return(transition.ToState);
            }
        }

        return(null);
    }