Exemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        BorderScript borderScript = (BorderScript)target;

        if (GUILayout.Button("Check for Cameras"))
        {
            borderScript.CheckForCams();
        }
        if (GUILayout.Button("Check BorderSize"))
        {
            borderScript.CheckBorderSize();
        }
    }
 private void Awake()
 {
     borderScript = this;
 }
 void Start()
 {
     borderScript = GetComponent <BorderScript>();
     ManagerMenu  = GameObject.FindGameObjectWithTag("MenuManager");
 }
Exemplo n.º 4
0
    /*
     * A method to generate the end of the maze
     * Since the maze does not have only one path to the exit, the end
     * that Austin Takechi generated could be too close to the beginning
     * thus, this method is necessary.
     * The end of the maze is always located against the back wall
     */
    void FindExit()
    {
        int pos = (int)Random.Range(0, Size.x-1);
        if (Grid[pos,(int)Size.z-1].position.y == 0f){
            VictorySquare = Grid[pos,(int)Size.z-1];
            VictorySquare.collider.enabled = false;
            VictorySquare.renderer.enabled = false;
            //replace the exit with an elevator
            Transform newCell = (Transform)Instantiate(EndCellPrefab, VictorySquare.position, Quaternion.identity);
            newCell.rigidbody.isKinematic = false;
            VictorySquare = newCell;
            Victory = Grid[pos,(int)Size.z-1].position;
            Grid[pos,(int)Size.z-1].parent = null;

            //replace the start of the maze with an elevator too
            //this is done here because the maze generation algorithm must finish first
            ChangeStart();

            //create a tunnel around the exit so when the elevator moves down, there are walls constantly surrounding the player
            Border = GameObject.Find("BorderObject").GetComponent<BorderScript>();
            Border.CreateTunnel(VictorySquare.position);
            return;
        }
        //recursive call in case the square we find is a wall
        FindExit ();
    }