Exemplo n.º 1
0
    public bool Transition(string newState, bool secondaryCondition = true)
    {
        string currentNodeName = _stateMachinePlayback.GetCurrentNode();

        string[] travelPath = _stateMachinePlayback.GetTravelPath();
        // if there is no travel path just put new state there so it passes
        if (travelPath.Length == 0)
        {
            travelPath = new string[1] {
                ""
            }
        }
        ;
        if (_stateMachine.HasTransition(currentNodeName, newState) && travelPath[0] != newState && secondaryCondition)
        {
            _stateMachinePlayback.Travel(newState);
            return(true);
        }
        return(false);
    }