コード例 #1
0
    GameState GetNext(StateCommands command)
    {
        //construct transition based on machine current state and the command
        ScriptPhaseTransition newTransition = new ScriptPhaseTransition(CurrentState, command);

        //store the location to got to here
        GameState newState;

        if (!allTransitions.TryGetValue(newTransition, out newState))
        {
            throw new UnityException("Invalid Game State transition " + CurrentState + " -> " + command);
        }

        //return the new state
        return(newState);
    }
コード例 #2
0
    GameState GetNext(StateCommands command)
    {
        //construct transition based on machine current state and the command
        ScriptPhaseTransition newTransition = new ScriptPhaseTransition(CurrentState, command);

        //store the location to got to here
        GameState newState;

        if (!allTransitions.TryGetValue(newTransition, out newState))
            throw new UnityException("Invalid Game State transition " + CurrentState + " -> " + command);

        //return the new state
        return newState;
    }
コード例 #3
0
    public override bool Equals(object obj)
    {
        ScriptPhaseTransition other = obj as ScriptPhaseTransition;

        return(other != null && this.currentPhase == other.currentPhase && this.command == other.command);
    }