private void PlaceObject() { if (!CanPlace(cursorPosition)) { DisplayWarning("Field is already occupied by different object!", 2000); return; } switch (selectedItem) { case GameObject.Wall: WallPlacementMode(); break; case GameObject.EnemyHorizontal: Enemy enemyHorizontal = new Enemy(new Point(cursorPosition.X, cursorPosition.Y), Enemy.FacingHorizontal); enemies.Add(enemyHorizontal); enemyHorizontal.Paint(); break; case GameObject.EnemyVertical: Enemy enemyVertical = new Enemy(new Point(cursorPosition.X, cursorPosition.Y), Enemy.FacingVertical); enemies.Add(enemyVertical); enemyVertical.Paint(); break; case GameObject.Coin: Coin coin = new Coin(new Point(cursorPosition.X, cursorPosition.Y), 1); coins.Add(coin); coin.Paint(); break; case GameObject.Player: if (player != null) { DisplayWarning("Can't place more than one player object!", 2000); break; } player = new Player(new Point(cursorPosition.X, cursorPosition.Y)); player.Paint(); break; case GameObject.Finish: Finish finish = new Finish(new Point(cursorPosition.X, cursorPosition.Y)); finishes.Add(finish); finish.Paint(); break; } }