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; } }
public virtual void draw() { if (pos.gotoPoint()) { color.apply(); Console.Write(sign); Game.instance().getWindow().resetColor(); } }
public void pop() { if (state != null) { state.onExit(); Game.instance().getWindow().clean(); state = null; } }
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(); } }
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(); }