public void removeTurret(int rows, int cols) { structures[rows, cols] = new EmptyTile(new Vector2( (int)((screenWidth / 2) - (4.5 - cols) * sideLength), (int)((screenHeight / 2) - (4.5 - rows) * sideLength)), groundTexture, bank, this, rows, cols, sideLength, true); }
private void Load(string filePath) { Stream inStream = File.OpenRead(filePath); BinaryReader input = new BinaryReader(inStream); int height = input.ReadInt32(); int width = input.ReadInt32(); //set enemy health to input.ReadInt32() //set enemy damage to input.ReadInt32() //set turret health to input.ReadInt32() //set enemy damage to input.ReadInt32() //set main structure health to input.ReadInt32() structures = new Structure[height, width]; sideLength = (int)((screenHeight / height) * 0.8); for (int r = 0; r < height; r++) { for (int c = 0; c < width; c++) { switch (input.ReadInt32()) { case 0: structures[r, c] = new EmptyTile(new Vector2( (int)((screenWidth / 2) - (4.5 - c) * sideLength), (int)((screenHeight / 2) - (4.5 - r) * sideLength)), groundTexture, bank, this, r, c, sideLength, true); break; case 1: structures[r, c] = new BasicTurret(new Vector2( (int)((screenWidth / 2) - (4.5 - c) * sideLength), (int)((screenHeight / 2) - (4.5 - r) * sideLength)), turretTexture, bulletTexture, groundTexture, healthBar, sideLength, r, c, this, bank); break; case 2: if (mainStructure == null) { mainStructure = new MainStructure(new Vector2( (int)((screenWidth / 2) - (4 - c) * sideLength), (int)((screenHeight / 2) - (4 - r) * sideLength)), mainStructureTexture, groundTexture, healthBar, sideLength * 2); structures[r, c] = mainStructure; } break; case 3: structures[r, c] = new Wall(new Vector2( (int)((screenWidth / 2) - (4.5 - c) * sideLength), (int)((screenHeight / 2) - (4.5 - r) * sideLength)), wallTexture, groundTexture, healthBar, bank, this, sideLength, r, c); break; } } } }