예제 #1
0
    // Cache

    // **********************************************************************
    //                          OVERLOADED METHODS
    // **********************************************************************

    private void Start()
    {
        debugCameraPrevious = CameraLabel.NONE;

        // Follow player by default
        SetPlayerCamera(true);
    }
예제 #2
0
    // **********************************************************************
    //                            DEBUG TOOLS
    // **********************************************************************

    /*
     * +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
     * SUMMARY: DebugCameraSwitcherTool
     * This function allows developers to switch between cameras.
     * +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
     */
    private void DebugCameraSwitcherTool()
    {
        // Only set priority if the camera has not been set already.
        bool switchable = (debugCamera != debugCameraPrevious) || debugCamera == CameraLabel.NONE;

        if (debugToolEnabled && switchable)
        {
            switch (debugCamera)
            {
            case CameraLabel.CAM_SPIRIT:
                SetSpiritCamera(true);
                SetPlayerCamera(false);
                break;

            case CameraLabel.CAM_PLAYER:
                SetPlayerCamera(true);
                SetSpiritCamera(false);
                break;

            default:
                Debug.Log("ERROR (DebugCameraSwitcherTool): Default camera isn't set up.");
                break;
            }
        }

        debugCameraPrevious = debugCamera;
    }
예제 #3
0
    // **********************************************************************
    //                      PRIVATE METHODS / COROUTINES
    // **********************************************************************

    /*
     * +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
     * SUMMARY: Set{CameraSystem}
     * This function can be used by game objects to force camera system to
     * be in use by setting priority to max.
     * +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
     */
    private void SetCameraSystem(CameraLabel selectedSystem, bool setting)
    {
        switch (selectedSystem)
        {
        case CameraLabel.CAM_PLAYER:

            // If enabling, set player cam to max priority
            // Else, return player cam to default settings
            if (enabled == true)
            {
                playerCamSystem.cam.GetComponent <CinemachineVirtualCamera>().Priority = maxCameraPriority;
            }
            else
            {
                playerCamSystem.cam.GetComponent <CinemachineVirtualCamera>().Priority = playerCamSystem.defaultPriority;
            }
            break;


        case CameraLabel.CAM_SPIRIT:

            // If enabling, set spirit cam to max priority
            // Else, return spirit cam to default settings
            if (setting == true)
            {
                spiritCamSystem.cam.GetComponent <CinemachineVirtualCamera>().Priority = this.maxCameraPriority;
            }
            else
            {
                spiritCamSystem.cam.GetComponent <CinemachineVirtualCamera>().Priority = spiritCamSystem.defaultPriority;
            }
            break;


        default:
            Debug.Log("Selected camera is not handled.");
            break;
        }
    }