コード例 #1
0
    /// <summary>
    /// Adds a new quadrant to the scene and resizes all the quadrants and their cameras
    /// </summary>
    private void AddQuadrant(Camera cam)
    {
        if (m_Quadrants.Count < 4)
        {
            //create a new quadrant and add it to the list
            Quadrant newQuad = new Quadrant(false);
            m_Quadrants.Add(newQuad);

            //resize the quadrants and add the new camera to it
            ResizeQuadrant();
            newQuad.AddCamera(cam);
        }

        else
        {
            Debug.LogWarning("Too many quadrants!");
        }
    }
コード例 #2
0
    /// <summary>
    /// Initial setup for start of game camera
    /// </summary>
    private void InitialSetup()
    {
        //set up the initial quadrant
        Quadrant quad1 = new Quadrant(true);

        m_Quadrants.Add(quad1);
        ResizeQuadrant();

        //get the player camera and add it to the quadrant
        Camera playerCam = FindObjectOfType <Camera>();

        quad1.AddCamera(playerCam);

        //get the player
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        //setup the camera with the proper player target and resize all cameras
        SetupCamera(playerCam, player);
    }