コード例 #1
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);
     }));
 }
コード例 #2
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;
         }
     }));
 }
コード例 #3
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);
            }));
        }
コード例 #4
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);
     }));
 }