public void SetUp() { cell = new MazeCell(new Point2D(1, 1)); wall = new MazeWall(new Point2D(1, 1)); exit = new MazeExit(new Point2D(1, 1)); entrance = new MazeEntrance(new Point2D(1, 1)); collection = new MazeCellCollection(); }
void Start() { grid = FindObjectOfType <GridContructor> (); mazeExit = FindObjectOfType <MazeExit> (); turnController = FindObjectOfType <TurnController> (); player = FindObjectsOfType <Player> (); minotaurLife = player.Length; }
void HandleMazeMinigame() { MazeExit exit = currentInteractive.GetComponent <MazeExit>(); Vector2 direction = exit.direction; MazeController.instance.ChangeNode(direction); playingInteraction = false; }
private MazeExit CreateExit(IntVector2 coordinates) { MazeExit newCell = Instantiate(exitPrefab) as MazeExit; cells[coordinates.x, coordinates.y] = newCell; newCell.coordinates = coordinates; newCell.name = "Maze Exit " + coordinates.x + ", " + coordinates.y; newCell.transform.parent = transform; newCell.transform.localPosition = new Vector3( coordinates.x * newCell.size.x - size.x * 0.5f * newCell.size.x + 0.5f * newCell.size.x, coordinates.y * newCell.size.y - size.y * 0.5f * newCell.size.y + 0.5f * newCell.size.y, 0f ); return newCell; }
private void CreateExit(List <MazeCellEdge> createdWalls, List <MazeCell> cells) { /* Version 3 * */ //Debug statement, if the function is called but the exit has been created already if (ExitCreated) { return; } outsideCells = new List <MazeCell>(); foreach (MazeCell cell in cells) { if (cell.coordinates.x == 0 && cell.coordinates.z < size.z || cell.coordinates.x < size.x && cell.coordinates.z == 0 || cell.coordinates.x == size.x - 1 && cell.coordinates.z < size.z || cell.coordinates.x < size.x && cell.coordinates.z == size.z - 1) { outsideCells.Add(cell); } } while (!ExitCreated) { int cellIndex = Random.Range(0, outsideCells.Count - 1); MazeCell selectedCell = outsideCells[cellIndex]; int wallIndex = 0; //wall is child foreach (MazeCellEdge wall in createdWalls) { if (selectedCell.coordinates.x == 0 && selectedCell.coordinates.z < size.z && wall.direction == MazeDirection.West || selectedCell.coordinates.x < size.x && selectedCell.coordinates.z == 0 && wall.direction == MazeDirection.South || selectedCell.coordinates.x == size.x - 1 && selectedCell.coordinates.z < size.z && wall.direction == MazeDirection.East || selectedCell.coordinates.x < size.x && selectedCell.coordinates.z == size.z - 1 && wall.direction == MazeDirection.North) { Destroy(selectedCell.GetComponentInChildren <MazeCell>().GetEdge(wall.direction).gameObject); MazeExit exitWall = Instantiate(exitPrefab) as MazeExit; exitWall.Initialize(selectedCell, null, wall.direction); ExitCreated = true; break; } wallIndex++; } } }