예제 #1
0
        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];
                    }
                }
            }
        }
예제 #2
0
        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;
        }
예제 #3
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);
 }
예제 #4
0
 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;
 }
예제 #5
0
 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++;
 }
예제 #6
0
 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;
     }
 }