public MapGenerator(MapIds mapIds, int attemptsNumber = 30) { if (attemptsNumber < 1) { throw new ArgumentException("Too low AttemptsNumber count. It must be more then 0." + "Entered attemptsNumber is: " + attemptsNumber, "attemptsNumber"); } MapIds = mapIds; AttemptsNumber = attemptsNumber; }
private int[,] GanerateMapIds(PathMap pathMap, MapIds mapIds) { int[,] idsMap = new int[pathMap.PathMapArray.GetLength(0), pathMap.PathMapArray.GetLength(1)]; for (int y = 0; y < pathMap.PathMapArray.GetLength(0); y++) { for (int x = 0; x < pathMap.PathMapArray.GetLength(1); x++) { if (pathMap.PathMapArray[y, x] == false) { idsMap[y, x] = mapIds.WallsIds.ElementAt(UnityEngine.Random.Range(0, mapIds.WallsIds.Count() - 1)); } else { idsMap[y, x] = mapIds.PassId; } } } idsMap[pathMap.Enter.Y, pathMap.Enter.X] = mapIds.EnterId; idsMap[pathMap.Exit.Y, pathMap.Exit.X] = mapIds.ExitId; return(idsMap); }