示例#1
0
    //Create everything
    public void mainProgramWithoutWaitingTime()
    {
        DestroyOldMaze ();
        if (useRandomSeed) {
            seed = Random.Range (0, 1000000000).ToString ();

        }
        pseudoRandom = new System.Random (seed.GetHashCode ());

            newGridCreator = new GridCreator (length, width);
            gridWidth = newGridCreator.getGridWidth ();
            gridLength = newGridCreator.getGridLength ();
            newGridCreator.MainProgramm ();
            Room[,] tmp = newGridCreator.getGridOfRooms ();
            xGap = wall.GetComponent<Renderer> ().bounds.size.x;
            zGap = wall.GetComponent<Renderer> ().bounds.size.z;
            deadEndList = new List<GameObject> ();
            GameObject mainCam = GameObject.FindGameObjectWithTag ("MainCamera");
            mainCam.transform.position = new Vector3 (xGap * ((gridLength / 2) - 1) + xGap / 2, 100, zGap * (gridWidth / 2));
            mainCam.transform.rotation = Quaternion.Euler (90, 0, 0);
            mainCam.GetComponent<Camera> ().orthographic = true;
            mainCam.GetComponent<Camera> ().orthographicSize = xGap * ((gridLength / 2) + 2);

            Labyrinth = new GameObject ();
            Labyrinth.name = "Labyrinth";
            Labyrinth.tag = "Labyrinth";

            GameObject generalMaze = new GameObject ();
            generalMaze.name = "GeneralMaze";
            generalMaze.transform.parent = Labyrinth.transform;

            fillMazeWithTiles (tmp, generalMaze);
            buildBorderWalls (Labyrinth);

            if(Application.isPlaying)
                Destroy(this);
            else
                DestroyImmediate(this);
    }