public void InitializeForest() { var totalSpots = (Bound * Bound); var initialLumberJackCount = totalSpots * .1; for (var i = 0; i < initialLumberJackCount; i++) { GenerateLumberJack(); } var initialTreeCount = totalSpots * .5; for (var i = 0; i < initialTreeCount; i++) { var assigned = false; while (!assigned) { var desiredX = _numberGeneratorService.GetNextRandomOfBound(Bound); var desiredY = _numberGeneratorService.GetNextRandomOfBound(Bound); if (IsOpenSpot(desiredX, desiredY)) { assigned = true; ForestObjects.Add(new Tree(desiredX, desiredY, new SaplingGeneratorService(), TreeAge.Tree, _numberGeneratorService)); } } } var initialBearCount = totalSpots * .02; for (var i = 0; i < initialBearCount; i++) { GenerateBear(); } }
public void GenerateLumberJack() { var assigned = false; while (!assigned) { var desiredX = _numberGeneratorService.GetNextRandomOfBound(Bound); var desiredY = _numberGeneratorService.GetNextRandomOfBound(Bound); if (IsOpenSpot(desiredX, desiredY)) { ForestObjects.Add(new LumberJack(desiredX, desiredY, _numberGeneratorService)); assigned = true; } } }
public void AddForestObject(IForestObject forestObject) { ForestObjects.Add(forestObject); }