private void backtrack() { if (this.visitedCells.Count != 1) { this.visitedCells.Pop(); this.currCell = this.visitedCells.Peek(); moveTo(); } }
private void visitCell(gridCell visitedCell) { visitedCell.visited = true; visitedCell.path = true; touch((visitedCell.x + visitedCells.Peek().x) / 2, (visitedCell.y + visitedCells.Peek().y) / 2).visited = true; touch((visitedCell.x + visitedCells.Peek().x) / 2, (visitedCell.y + visitedCells.Peek().y) / 2).path = true; this.visitedCells.Push(visitedCell); this.currCell = visitedCell; moveTo(); }
public void Action(GameObject clickedObject) { if (build) { gridCell gridCell = clickedObject.GetComponent <gridCell>(); roomController roomController = clickedObject.GetComponent <roomController>(); if (gridCell != null) { if (thingToBuild != null) { gridCell.buildGameObject(thingToBuild); } } else if (roomController != null) { roomController.buildRoom(roomToBuild.prefab); } } else { Destroy(clickedObject.gameObject); } }
private void generate(/*int startX, int startY*/) { this.currCell = this.maze[this.startX * 2 + 1, this.startY * 2 + 1]; this.visitedCells.Push(this.currCell); visitCell(this.currCell); }