public void placeTurret(int rows, int cols, TurretType type) { switch (type) { case TurretType.Turret: if (bank.Purchase(100)) { structures[rows, cols] = new BasicTurret(new Vector2( (int)((screenWidth / 2) - (4.5 - cols) * sideLength), (int)((screenHeight / 2) - (4.5 - rows) * sideLength)), turretTexture, bulletTexture, groundTexture, healthBar, sideLength, rows, cols, this, bank); } break; case TurretType.Wall: if (bank.Purchase(50)) { structures[rows, cols] = new Wall(new Vector2( (int)((screenWidth / 2) - (4.5 - cols) * sideLength), (int)((screenHeight / 2) - (4.5 - rows) * sideLength)), wallTexture, groundTexture, healthBar, bank, this, sideLength, rows, cols); } break; } }
public void RepairOrDestroy(MouseState mouse, bool repair) { if (repair && (mouse.LeftButton == ButtonState.Pressed) && rectangle.Contains(mouse.Position)) { if (bank.Purchase(25)) { currentHealth = maxHealth; active = true; } } if (!repair && (mouse.LeftButton == ButtonState.Pressed) && rectangle.Contains(mouse.Position)) { map.removeTurret(row, col); bank.Deposit(50); } }