コード例 #1
0
 protected override void EndLastItem(GridGeneratorBase mono, int x, int y)
 {
     if (x * y != (Width - 1) * (Height - 1))
     {
         return;
     }
     base.EndLastItem(mono, x, y);
 }
コード例 #2
0
 protected override void EndLastItem(GridGeneratorBase mono, int x, int y)
 {
     if (_visitedCellCtr < Height * Width - 1)
     {
         return;
     }
     base.EndLastItem(mono, x, y);
 }
コード例 #3
0
 public override void Execute(GridGeneratorBase mono)
 {
     mono.StartCoroutine(WalkThroughCellsCoRoutine((x, y) =>
     {
         if (Cells[x][y].IsVisited)
         {
             return;
         }
         Cells[x][y].IsVisited = true;
         EndLastItem(mono, x, y);
     }));
 }
コード例 #4
0
 public override void Execute(GridGeneratorBase mono)
 {
     mono.StartCoroutine(WalkThroughCellsCoRoutine((x, y) =>
     {
         if (x == -1)
         {
             EndLastItem(mono, x, y);
         }
         else if (!Cells[x][y].IsVisited)
         {
             Cells[x][y].IsVisited = true;
         }
     }));
 }
コード例 #5
0
        public override void Execute(GridGeneratorBase mono)
        {
            int currentY        = 0;
            var sideWinderGroup = new List <int>();

            mono.StartCoroutine(WalkThroughCellsCoRoutine((x, y) =>
            {
                int wallToDelete;
                if (IsTopCell(y))
                {
                    wallToDelete = Constants.RIGHT;
                }
                else
                {
                    if (y == currentY)
                    {
                        sideWinderGroup.Add(x);
                    }
                    else
                    {
                        currentY = y;
                        sideWinderGroup.Clear();
                        sideWinderGroup.Add(x);
                    }

                    bool goUp = IsRightMostCell(x) || Utils.Percentage(50);
                    if (goUp)
                    {
                        x            = Utils.RandomSelectionFromArray(sideWinderGroup.ToArray());
                        wallToDelete = Constants.TOP;
                        sideWinderGroup.Clear();
                    }
                    else
                    {
                        wallToDelete = Constants.RIGHT;
                    }
                }
                Cells[x][y].DeleteWallWithPosition(wallToDelete);
                EndLastItem(mono, x, y);
            }));
        }
コード例 #6
0
 public override void Execute(GridGeneratorBase mono)
 {
     mono.StartCoroutine(WalkThroughCellsCoRoutine((x, y) =>
     {
         int wallToDelete;
         if (IsTopCell(y))
         {
             wallToDelete = Constants.RIGHT;
         }
         else if (IsRightMostCell(x))
         {
             wallToDelete = Constants.TOP;
         }
         else
         {
             wallToDelete = Utils.Percentage(50) ? Constants.TOP : Constants.RIGHT;
         }
         Cells[x][y].DeleteWallWithPosition(wallToDelete);
         EndLastItem(mono, x, y);
     }));
 }
コード例 #7
0
 /// <summary>
 /// RecursiveBacktracker does not call this
 /// it completely overrides something it doesn't want
 /// from RandomWalkAlgo
 /// </summary>
 protected virtual void EndLastItem(GridGeneratorBase mono, int x, int y)
 {
     mono.EndCoroutine();
 }
コード例 #8
0
 public abstract void Execute(GridGeneratorBase gridGeneratorBase);
コード例 #9
0
 public abstract override void Execute(GridGeneratorBase mono);
コード例 #10
0
 protected override void EndLastItem(GridGeneratorBase mono, int x, int y)
 {
     mono.EndCoroutine();
 }