Exemple #1
0
    private static string currentCam = "Main";//bz is the first camera on

    public static void ChangeTo(string newVal)
    {
        if (currentCam != newVal)
        {
            currentCam = newVal;
        }
        else//if is reACtivating same cam will return
        {
            return;
        }

        DisableAllCams();

        if (newVal == "Main")
        {
            mainMenuCamera.enabled = true;
            mainMenuCamera.GetComponent <AudioListener>().enabled = true;
        }
        else if (newVal == "Game")
        {
            if (CAMRTS)
            {
                CAMRTS.CamSensivity = 6;
            }

            Cursor.visible = true;

            if (rtsCamera != null)
            {
                rtsCamera.enabled = true;
                rtsCamera.GetComponent <AudioListener>().enabled = true;
            }
        }
        else if (newVal == "First")
        {
            CAMRTS.CamSensivity = 0;

            firstPersonCamera = GameObject.Find("FirstPersonCharacter").GetComponent <Camera>();

            if (firstPersonCamera != null)
            {
                firstPersonCamera.enabled = true;
                firstPersonCamera.GetComponent <AudioListener>().enabled = true;
            }
        }
        AudioPlayer.CameraWasChanged();
    }