Ejemplo n.º 1
0
    private IEnumerator BeginGame()
    {
        Camera.main.clearFlags = CameraClearFlags.Skybox;
        Camera.main.rect       = new Rect(0f, 0f, 1f, 1f);
        mazeInstance           = Instantiate(mazePrefab) as Maze;
        yield return(StartCoroutine(mazeInstance.Generate()));

        playerInstance      = Instantiate(playerPrefab) as Player;
        playerInstance.name = "player";
        //MazeCell temp = mazeInstance.GetCell (mazeInstance.RandomCoordinates);

        //temp = mazeInstance.GetCell (mazeInstance.RandomCoordinates);
        //Vector3 sLoc = new Vector3 (0.5f, 0.5f, 0.5f);
        Vector3 sLoc = new Vector3(-((mazeInstance.size.x - 1) * mazeInstance.mazeMeshScale) / 2, 0.5f, -((mazeInstance.size.z - 1) * mazeInstance.mazeMeshScale) / 2);

        //Vector3 sLoc = new Vector3 (-2f, 0f, -2f);
        //Debug.Log (-(mazeInstance.size.x - 1) + " and " + -(mazeInstance.size.z-1));
        playerInstance.SetLocation(sLoc);
        //playerInstance.SetLocation(mazeInstance.GetCell(mazeInstance.RandomCoordinates));
        //Camera.main.enabled = false;
        Camera.main.clearFlags = CameraClearFlags.Depth;
        Camera.main.rect       = new Rect(0f, 0f, 0.5f, 0.5f);
        Destroy(Camera.main.gameObject);

        resourceBar.SetResourceBarVisibility(true);
        guiManager.SetPauseButtonVisibility(true);
        guiManager.DisplayGameUI();
        minimapCam.enabled = false;

        gameStarted = true;
    }