Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            MarioStateMachine mario = new MarioStateMachine();

            mario.obtainMushRoom();
            int       score = mario.getScore();
            StateEnum state = mario.getCurrentState();

            Console.WriteLine("mario score: " + score + "; state: " + state);
            mario.obtainCape();
            int       score2 = mario.getScore();
            StateEnum state2 = mario.getCurrentState();

            Console.WriteLine("mario score: " + score2 + "; state: " + state2);
            Console.ReadKey();
        }
Ejemplo n.º 2
0
 public void obtainCape()
 {
     stateMachine.setCurrentState(new CapeMario(stateMachine));
     stateMachine.setScore(stateMachine.getScore() + 200);
 }
Ejemplo n.º 3
0
 public void obtainMushRoom()
 {
     stateMachine.setCurrentState(new SuperMario(stateMachine));
     stateMachine.setScore(stateMachine.getScore() + 100);
 }