public void GenerateMap(Level newLevel) { deleteCurrentMap(); Map map = new Map(newLevel); navigation = GetComponent <Navigation>(); navigation.setup(map.config, tileSize, mapHolder, maxMapSize); obstacleFactory = GetComponent <ObstacleFactory>(); tileMap = obstacleFactory.placeGroundTiles(map, mapHolder, outlinePercent, tileSize); List <Coord> CoordsWithObstacle = obstacleFactory.placeObstacles(map, mapHolder, outlinePercent, tileSize); map.markCoordAsOccupiedByObstacle(CoordsWithObstacle); map.shuffleFreeCoords(); generatedMap = map; }