public PlayField(PlayField playField) { this.GoldAvailableForAttack = playField.GoldAvailableForAttack; this.GoldSpentForDefense = playField.GoldSpentForDefense; this.ResultScore = playField.ResultScore; this.MinesCount = playField.MinesCount; for (int x = 0; x < PlayFieldSize; x++) { for (int y = 0; y < PlayFieldSize; y++) { this[x, y] = new DefenseUnit(playField[x, y].Type, playField[x, y].Count); } } for (int x = 0; x < PlayFieldSize; x++) { for (int y = 0; y < PlayFieldSize; y++) { for (int z = 0; z <= MaxBombRadius; z++) { this.playFieldBombsScores[y, x, z] = playField.playFieldBombsScores[y, x, z]; } } } }
public PlayField(int gold = GameRules.StartingGold) { for (int x = 0; x < PlayFieldSize; x++) { for (int y = 0; y < PlayFieldSize; y++) { this[x, y] = new DefenseUnit(DefenseUnitTypes.Empty); } } this.GoldAvailableForAttack = gold; this.goldSpentForDefense = 0; }
private void RemoveUnitAt(int x, int y) { this.ResultScore += this[x, y].Price * this[x, y].Count; if (this[x, y].Type == DefenseUnitTypes.Mine) { this.MinesCount--; } this[x, y] = new DefenseUnit(DefenseUnitTypes.Empty); }
public void InsertChicken(int x, int y, int count = 1) { this[x, y] = new DefenseUnit(DefenseUnitTypes.Chicken, count); this.GoldSpentForDefense += this[x, y].Count * this[x, y].Price; }
public void InsertMine(int x, int y) { this[x, y] = new DefenseUnit(DefenseUnitTypes.Mine); this.GoldSpentForDefense += this[x, y].Count * this[x, y].Price; this.MinesCount++; }
public void InsertDefenseUnit(int x, int y, DefenseUnitTypes unitType, int count = 1) { this[x, y] = new DefenseUnit(unitType, count); this.GoldSpentForDefense += this[x, y].Count * this[x, y].Price; if (unitType == DefenseUnitTypes.Mine) { this.MinesCount += count; } }