private void OnInputReceived(object sender, IGameEventArgs eventArgs) { if (eventArgs.ReceivedCommand.Key == System.ConsoleKey.LeftArrow) { if (PosX != 1) { PosX--; } } if (eventArgs.ReceivedCommand.Key == System.ConsoleKey.RightArrow) { if (PosX != Board.SizeX - 2) { PosX++; } } if (eventArgs.ReceivedCommand.Key == System.ConsoleKey.UpArrow) { if (PosY != 1) { PosY--; } } if (eventArgs.ReceivedCommand.Key == System.ConsoleKey.DownArrow) { if (PosY != Board.SizeY - 2) { PosY++; } } }
public Registry() { this.Board = new Board(); this.Hero = new Hero(); this.Drawing = new Drawing(); this.UserInteraction = new UserInteraction(); this.GetGameEventArgs = new GameEventArgs(); }
private void OnInputReceived(object sender, IGameEventArgs eventArgs) { switch (eventArgs.ReceivedCommand.Key) { case System.ConsoleKey.LeftArrow: if (PosX != 1) { PosX--; } break; case System.ConsoleKey.RightArrow: if (PosX != Board.SizeX - 2) { PosX++; } break; case System.ConsoleKey.UpArrow: if (PosY != 1) { PosY--; } break; case System.ConsoleKey.DownArrow: if (PosY != Board.SizeY - 2) { PosY++; } break; default: break; } }
private void OnInputReceived(object sender, IGameEventArgs eventArgs) { DrawAll(); }