Ejemplo n.º 1
0
        public override void input(ConsoleKeyInfo key)
        {
            switch (key.Key)
            {
            case ConsoleKey.Escape:
                Game.instance().getStateMachine().push(new IntroState());
                break;

            case ConsoleKey.UpArrow:
                player.move(0, -1);
                break;

            case ConsoleKey.DownArrow:
                player.move(0, 1);
                break;

            case ConsoleKey.RightArrow:
                player.move(1, 0);
                break;

            case ConsoleKey.LeftArrow:
                player.move(-1, 0);
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
 public virtual void draw()
 {
     if (pos.gotoPoint())
     {
         color.apply();
         Console.Write(sign);
         Game.instance().getWindow().resetColor();
     }
 }
Ejemplo n.º 3
0
 public void pop()
 {
     if (state != null)
     {
         state.onExit();
         Game.instance().getWindow().clean();
         state = null;
     }
 }
Ejemplo n.º 4
0
 public override void input(ConsoleKeyInfo key)
 {
     if (key.Key == ConsoleKey.Enter)
     {
         Game.instance().getStateMachine().push(new PlayState());
     }
     else if (key.Key == ConsoleKey.Escape)
     {
         Game.instance().exit();
     }
 }
Ejemplo n.º 5
0
        public void push(GameState state)
        {
            if (this.state == null)
            {
                this.state = state;
            }
            else
            {
                this.state.onExit();
                Game.instance().getWindow().clean();
                this.state = state;
            }

            this.state.onEnter();
        }