Example #1
0
 private void BeginGame()
 {
     mazeInstance = Instantiate(mazePrefab) as Maze2;
     mazeInstance.transform.parent = transform;
     StartCoroutine(mazeInstance.Generate());
     Debug.Log("BeginGame()");
 }
Example #2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #3
0
            private void changeVertical()
            {
                Vertical = !Vertical;
                Maze2 maze = to_clear as Maze2;

                if (maze != null)
                {
                    maze.clear();
                }
            }
Example #4
0
            private void state_changed()
            {
                var wallSize = getWallSize();

                if (door != null)
                {
                    door.Vertical = vertical;
                    Size doorSize = getDoorSize();
                    door.Size = vertical ? doorSize : new Size(doorSize.Height, doorSize.Width);

                    Point doorPos = new Point((this.Size.Width - doorSize.Width) / 2, (this.Size.Height - doorSize.Height) / 2);
                    door.Location = vertical ? doorPos : new Point(doorPos.Y, doorPos.X);

                    wallSize = new Size(wallSize.Width, doorPos.Y);
                }

                p1.Size = vertical ? wallSize : new Size(wallSize.Height, wallSize.Width);

                Point p1Pos = new Point((this.Size.Width - wallSize.Width) / 2, 0);

                p1.Location = vertical ? p1Pos : new Point(p1Pos.Y, p1Pos.X);

                if (door == null)
                {
                    p2.Size = new Size(0, 0);
                }
                else
                {
                    p2.Size = p1.Size;
                    Point p2Pos = new Point(p1Pos.X, this.Size.Height - wallSize.Height);
                    p2.Location = vertical ? p2Pos : new Point(p2Pos.Y, p2Pos.X);
                }

                Maze2 maze = to_clear as Maze2;

                if (maze != null)
                {
                    maze.clear();
                }
            }