Exemplo n.º 1
0
 private void backtrack()
 {
     if (this.visitedCells.Count != 1)
     {
         this.visitedCells.Pop();
         this.currCell = this.visitedCells.Peek();
         moveTo();
     }
 }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 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);
 }