/// <summary> /// Populates the world by adding plants and obstacles /// </summary> private void populateWorld() { for (int plantNum = 0; plantNum < Simulation.getPlantPopulation(); plantNum++) { int[] xy = getRandomClearTile(); if (xy[0] == -1 && xy[1] == -1) { throw new Exception("World is full, cannot add any further content"); } else { Tile t = getTile(xy[1], xy[0]); Plant p = new Plant(randomNumberGenerator); p.setLocation(xy[0], xy[1]); plantList.Add(p); t.addPlant(p); } } for (int obstNum = 0; obstNum < Simulation.getNumObstacles(); obstNum++) { int[] xy = getRandomClearTile(); if (xy[0] == -1 && xy[1] == -1) { throw new Exception("World is full, cannot add any further content"); } else { Tile t = getTile(xy[1], xy[0]); Obstacle o = new Obstacle(); o.setLocation(xy[0], xy[1]); t.addObstacle(o); } } }