static void KeyPressHandler() { ConsoleKeyInfo input = new ConsoleKeyInfo(); while (Alive) { input = Game.GetKeyPress(false); lock ("MOVING") { if (input.Key == ConsoleKey.UpArrow) { player.MoveDraw(Direction.Up); } else if (input.Key == ConsoleKey.DownArrow) { player.MoveDraw(Direction.Down); } else if (input.Key == ConsoleKey.RightArrow) { player.MoveDraw(Direction.Right); } else if (input.Key == ConsoleKey.LeftArrow) { player.MoveDraw(Direction.Left); } else if (input.Key == ConsoleKey.Spacebar) { int tempX = 0, tempY = 0; if (player.Next(player.Direction, ref tempX, ref tempY).ObjectType == "ClosedDoor") { ((Tile)region.Map[player.Symbol.X + tempX, player.Symbol.Y + tempY]).ChangeType("OpenedDoor"); ((Tile)region.Map[player.Symbol.X + tempX, player.Symbol.Y + tempY]).ChangeCharacter('/'); ((Tile)region.Map[player.Symbol.X + tempX, player.Symbol.Y + tempY]).Symbol.Draw(); } else if (player.Next(player.Direction, ref tempX, ref tempY).ObjectType == "OpenedDoor") { ((Tile)region.Map[player.Symbol.X + tempX, player.Symbol.Y + tempY]).ChangeType("ClosedDoor"); ((Tile)region.Map[player.Symbol.X + tempX, player.Symbol.Y + tempY]).ChangeCharacter('%'); ((Tile)region.Map[player.Symbol.X + tempX, player.Symbol.Y + tempY]).Symbol.Draw(); } else { bullet.Symbol.X = player.Symbol.X; bullet.Symbol.Y = player.Symbol.Y; bullet.Direction = player.Direction; if (bullets > 0) { bullets--; } UpdateBullets(); shoot = true; } } } } }