public void Toggle_Effects()
    {
        effectsIsOn = !effectsIsOn;

        // Depth of Field
        DepthOfFieldDeprecated dof = GameObject.FindObjectOfType <DepthOfFieldDeprecated> ();

        if (dof)
        {
            dof.enabled = effectsIsOn;
        }

        // Bloom
        BloomOptimized bloom = GameObject.FindObjectOfType <BloomOptimized> ();

        if (bloom)
        {
            bloom.enabled = effectsIsOn;
        }


        // Sun Shaft
        SunShafts[] sunShaftS = GameObject.FindObjectsOfType <SunShafts> ();
        for (int a = 0; a < sunShaftS.Length; a++)
        {
            sunShaftS [a].enabled = effectsIsOn;
        }

        // Color Grading
        MobileColorGrading colorGrading = GameObject.FindObjectOfType <MobileColorGrading> ();

        if (colorGrading)
        {
            colorGrading.enabled = effectsIsOn;
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        Invoke("EnableInput", 3);

        Time.timeScale = 1;

        roomInfoObject.SetActive(false);

        directionalLight = GameObject.Find("Directional Light").GetComponent<Light>();
        restorePointLightColor = directionalLight.color;
        titleScreenLightColor = Color.white;

        cController = playerCameraObject.GetComponent<CameraController>();
        cController.lookAtOtherTarget = lookAtTarget;

        dof = playerCameraObject.GetComponent<DepthOfFieldDeprecated>();
        dof.objectFocus = lookAtTarget.transform;

        gradientImage = transform.Find("Rainbow Gradient").GetComponent<RawImage>();
        upgradeAreaTrigger = GameObject.Find("Upgrade Area Trigger");
        upgradeAreaTrigger.GetComponent<UpgradeArea> ().enabled = false;

        playerObject.SetActive(false);

        lvl = GameObject.Find("Level").GetComponent<Level>();
        lvl.enabled = false;

        logoImage.color = new Color(0,0,0,0);
        continueText.color = new Color(0,0,0,0);

        hideMapButton = GameObject.Find ("Map Button").GetComponent<HideHUDElement> ();

        if(!invHUD){
            invHUD = GameObject.Find("HUD_Inventory").GetComponent<HUD_Inventory>();
            healthHUD = GameObject.Find("HUD_Healthbar").GetComponent<HUD_Healthbar>();
            hidePause = GameObject.Find("PauseButton").GetComponent<HideHUDElement>();
            hideTime = GameObject.Find("Time Button").GetComponent<HideHUDElement>();
        }

        if(GameObject.Find("HideTitleObject")){
            showTitleScreen = false;
            playerObject.SetActive(true);
            dof.objectFocus = playerObject.transform;
            EnableHudAndControls();
            Destroy(gameObject);
        }
    }
    public void Update_DOF(Camera mainCamera, bool enabled, DOFQuality quality, float blur, float range, bool visualize)
    {
        if (enabled)
        {
            if (!mainCamera.GetComponent <DepthOfFieldDeprecated> ())
            {
                mainCamera.gameObject.AddComponent <DepthOfFieldDeprecated> ();
                DepthOfFieldDeprecated dof = mainCamera.GetComponent <DepthOfFieldDeprecated> ();
                                #if UNITY_EDITOR
                if (mainCamera.GetComponent <AudioListener> ())
                {
                    UnityEditorInternal.ComponentUtility.MoveComponentDown(mainCamera.GetComponent <AudioListener> ());
                }

                if (mainCamera.GetComponent <MobileColorGrading> ())
                {
                    UnityEditorInternal.ComponentUtility.MoveComponentDown(mainCamera.GetComponent <MobileColorGrading> ());
                    UnityEditorInternal.ComponentUtility.MoveComponentDown(mainCamera.GetComponent <MobileColorGrading> ());
                }

                if (mainCamera.GetComponent <BloomOptimized> ())
                {
                    UnityEditorInternal.ComponentUtility.MoveComponentDown(mainCamera.GetComponent <BloomOptimized> ());
                    UnityEditorInternal.ComponentUtility.MoveComponentDown(mainCamera.GetComponent <BloomOptimized> ());
                }

                if (mainCamera.GetComponent <DepthOfFieldDeprecated> ())
                {
                    UnityEditorInternal.ComponentUtility.MoveComponentDown(mainCamera.GetComponent <DepthOfFieldDeprecated> ());
                    UnityEditorInternal.ComponentUtility.MoveComponentDown(mainCamera.GetComponent <DepthOfFieldDeprecated> ());
                }
                                #endif
                dof.bokehShader   = Shader.Find("Hidden/Dof/Bokeh34");
                dof.dofBlurShader = Shader.Find("Hidden/SeparableWeightedBlurDof34");
                dof.dofShader     = Shader.Find("Hidden/Dof/DepthOfField34");

                dof.simpleTweakMode = true;
                if (quality == DOFQuality.Low)
                {
                    dof.resolution = DepthOfFieldDeprecated.DofResolution.Low;
                }
                if (quality == DOFQuality.Medium)
                {
                    dof.resolution = DepthOfFieldDeprecated.DofResolution.Medium;
                }
                if (quality == DOFQuality.High)
                {
                    dof.resolution = DepthOfFieldDeprecated.DofResolution.High;
                }

                dof.visualize     = visualize;
                dof.smoothness    = range;
                dof.bluriness     = DepthOfFieldDeprecated.DofBlurriness.Low;
                dof.maxBlurSpread = blur;
            }
            else
            {
                DepthOfFieldDeprecated dof = mainCamera.GetComponent <DepthOfFieldDeprecated> ();


                dof.simpleTweakMode = true;
                if (quality == DOFQuality.Low)
                {
                    dof.resolution = DepthOfFieldDeprecated.DofResolution.Low;
                }
                if (quality == DOFQuality.Medium)
                {
                    dof.resolution = DepthOfFieldDeprecated.DofResolution.Medium;
                }
                if (quality == DOFQuality.High)
                {
                    dof.resolution = DepthOfFieldDeprecated.DofResolution.High;
                }

                dof.visualize     = visualize;
                dof.smoothness    = range;
                dof.bluriness     = DepthOfFieldDeprecated.DofBlurriness.Low;
                dof.maxBlurSpread = blur;
            }
        }
        if (!enabled)
        {
            if (mainCamera.GetComponent <DepthOfFieldDeprecated> ())
            {
                if (Application.isPlaying)
                {
                    Destroy(mainCamera.GetComponent <DepthOfFieldDeprecated> ());
                }
                else
                {
                    DestroyImmediate(mainCamera.GetComponent <DepthOfFieldDeprecated> ());
                }
            }
        }
    }