public void Run(int times, int xCoordinate, int yCoordinate) { TreeMatriza[xCoordinate, yCoordinate].Burn(this); PrintForest(); for (int i = 0; i < times; i++) { BurnTrees?.Invoke(this); PrintForest(); _doneBurning?.Invoke(); Thread.Sleep(2500); } }
public void Burn(Forest forest) { if (IsBurned() || _burnedThisRound) { return; } LifePoints--; _currentlyBurning = true; _burnedThisRound = true; if (Status == 'o') { forest.BurnTrees += this.Burn; Status = 'X'; return; } if (LifePoints == 0) { Status = '.'; return; } BurnTrees?.Invoke(forest); }