示例#1
0
 public override void OnRenderImage(RenderTexture source, RenderTexture destination)
 {
     if (!this.CheckResources() || null == this.noiseTexture)
     {
         Graphics.Blit(source, destination);
         if (null == this.noiseTexture)
         {
             Debug.LogWarning("Noise & Grain effect failing as noise texture is not assigned. please assign.", this.transform);
         }
     }
     else
     {
         this.softness = Mathf.Clamp(this.softness, (float)0, 0.99f);
         if (this.dx11Grain && this.supportDX11)
         {
             this.dx11NoiseMaterial.SetFloat("_DX11NoiseTime", (float)Time.frameCount);
             this.dx11NoiseMaterial.SetTexture("_NoiseTex", this.noiseTexture);
             this.dx11NoiseMaterial.SetVector("_NoisePerChannel", (!this.monochrome) ? this.intensities : Vector3.one);
             this.dx11NoiseMaterial.SetVector("_MidGrey", new Vector3(this.midGrey, 1f / (1f - this.midGrey), -1f / this.midGrey));
             this.dx11NoiseMaterial.SetVector("_NoiseAmount", new Vector3(this.generalIntensity, this.blackIntensity, this.whiteIntensity) * this.intensityMultiplier);
             if (this.softness > 1.401298E-45f)
             {
                 RenderTexture temporary = RenderTexture.GetTemporary((int)((float)source.width * (1f - this.softness)), (int)((float)source.height * (1f - this.softness)));
                 NoiseAndGrain.DrawNoiseQuadGrid(source, temporary, this.dx11NoiseMaterial, this.noiseTexture, (!this.monochrome) ? 2 : 3);
                 this.dx11NoiseMaterial.SetTexture("_NoiseTex", temporary);
                 Graphics.Blit(source, destination, this.dx11NoiseMaterial, 4);
                 RenderTexture.ReleaseTemporary(temporary);
             }
             else
             {
                 NoiseAndGrain.DrawNoiseQuadGrid(source, destination, this.dx11NoiseMaterial, this.noiseTexture, (!this.monochrome) ? 0 : 1);
             }
         }
         else
         {
             if (this.noiseTexture)
             {
                 this.noiseTexture.wrapMode   = TextureWrapMode.Repeat;
                 this.noiseTexture.filterMode = this.filterMode;
             }
             this.noiseMaterial.SetTexture("_NoiseTex", this.noiseTexture);
             this.noiseMaterial.SetVector("_NoisePerChannel", (!this.monochrome) ? this.intensities : Vector3.one);
             this.noiseMaterial.SetVector("_NoiseTilingPerChannel", (!this.monochrome) ? this.tiling : (Vector3.one * this.monochromeTiling));
             this.noiseMaterial.SetVector("_MidGrey", new Vector3(this.midGrey, 1f / (1f - this.midGrey), -1f / this.midGrey));
             this.noiseMaterial.SetVector("_NoiseAmount", new Vector3(this.generalIntensity, this.blackIntensity, this.whiteIntensity) * this.intensityMultiplier);
             if (this.softness > 1.401298E-45f)
             {
                 RenderTexture temporary2 = RenderTexture.GetTemporary((int)((float)source.width * (1f - this.softness)), (int)((float)source.height * (1f - this.softness)));
                 NoiseAndGrain.DrawNoiseQuadGrid(source, temporary2, this.noiseMaterial, this.noiseTexture, 2);
                 this.noiseMaterial.SetTexture("_NoiseTex", temporary2);
                 Graphics.Blit(source, destination, this.noiseMaterial, 1);
                 RenderTexture.ReleaseTemporary(temporary2);
             }
             else
             {
                 NoiseAndGrain.DrawNoiseQuadGrid(source, destination, this.noiseMaterial, this.noiseTexture, 0);
             }
         }
     }
 }
	// Use this for initialization
	void Start () {
        noiseAndGrain = GetComponent<NoiseAndGrain>();
        occlusion = GetComponent<ScreenSpaceAmbientOcclusion>();
        bloom = GetComponent<BloomOptimized>();

        qualityChanges();
	}
示例#3
0
 void Awake()
 {
     _camObject     = Camera.main.gameObject;
     _chromAb       = _camObject.GetComponent <VignetteAndChromaticAberration>();
     _noiseAndGrain = _camObject.GetComponent <NoiseAndGrain>();
     audio          = GetComponent <AudioSource>();
 }
示例#4
0
    //public DepthOfField DoF;

    void Start()
    {
        Floor = GameObject.Find("Floor").GetComponent <Renderer>();

        blueLight = GameObject.Find("BlueFlashlight");
        blueLight.GetComponent <Light>().intensity = 2;
        top              = GameObject.Find("Flare1");
        secondTop        = GameObject.Find("Flare2");
        middle           = GameObject.Find("Flare3");
        secondLowest     = GameObject.Find("Flare4");
        lowest           = GameObject.Find("Flare5");
        NightVisionLight = GameObject.Find("NightVision");
        NightVisionLight.SetActive(false);
        sonarLight = GameObject.Find("SonarLight");
        sonarLight.SetActive(false);
        hospitalGirl = GameObject.Find("HospitalGirl");
        lights       = GameObject.FindGameObjectsWithTag("Light");
        environ      = GameObject.FindGameObjectsWithTag("Environment");
        enemies      = GameObject.FindGameObjectsWithTag("Enemy");
        misc         = GameObject.FindGameObjectsWithTag("Other");
        items        = GameObject.FindGameObjectsWithTag("Item");

        flashLight    = GetComponent <Flashlight> ();
        grain         = GameObject.Find("Main Camera").GetComponent <NoiseAndGrain> ();
        grain.enabled = false;
        echoSpherez   = GetComponent <EchoSpherez> ();
        enemyDamage   = GameObject.Find("HospitalGirl").GetComponent <HospitalGirl> ();
        //DoF = Camera.main.GetComponent<DepthOfField>();
        rend = new Renderer[environ.Length];
    }
示例#5
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        fpsController       = gameObject.GetComponentInParent <FirstPersonController>();
        characterController = gameObject.GetComponentInParent <CharacterController>();
        analogGlitch        = gameObject.GetComponent <AnalogGlitch>();
        digitalGlitch       = gameObject.GetComponent <DigitalGlitch>();
        tiltShift           = gameObject.GetComponent <TiltShift>();
        noiseAndGrain       = gameObject.GetComponent <NoiseAndGrain>();
        bloomAndFlares      = gameObject.GetComponent <BloomAndFlares>();
        ramp = gameObject.GetComponents <Ramp>()[1];
        puffOfSmokeDetonator = puffOfSmoke.GetComponent <Detonator>();
        cameraShake          = gameObject.GetComponent <CameraShake>();
        hudPowerText         = hudPowerTextGroup.GetComponent <ShakyText>();

        //Initialization
        digitalGlitch.intensity      = .2f;
        analogGlitch.scanLineJitter  = .414f;
        analogGlitch.verticalJump    = .02f;
        analogGlitch.horizontalShake = .011f;
        analogGlitch.colorDrift      = .11f;

        powerPercent = powerStartPercent;
    }
示例#6
0
 void Start()
 {
     tonemapping   = GetComponent <Tonemapping>();
     vignette      = GetComponent <VignetteAndChromaticAberration>();
     noiseAndGrain = GetComponent <NoiseAndGrain>();
     inStealth     = true;
 }
示例#7
0
    // Use this for initialization
    void Start()
    {
        noiseAndGrain = GetComponent <NoiseAndGrain>();
        occlusion     = GetComponent <ScreenSpaceAmbientOcclusion>();
        bloom         = GetComponent <BloomOptimized>();

        qualityChanges();
    }
	void Start () {
			if (camera != null) {
				blurEffect = camera.gameObject.GetComponent<Blur> ();
				noiseEffect = camera.gameObject.GetComponent<NoiseAndGrain> ();
				vignetteEffect = camera.gameObject.GetComponent<VignetteAndChromaticAberration> ();
			}

			DisableVisualEffect ();
	}
示例#9
0
 void OnCollisionEnter(Collision other)
 {
     if (other.gameObject.tag == "HurtsPlayer") {
       noise = Camera.main.GetComponent<NoiseAndGrain>() as NoiseAndGrain;
       vignetting = Camera.main.GetComponent<Vignetting>() as Vignetting;
       lowPass = Camera.main.GetComponent<AudioLowPassFilter>() as AudioLowPassFilter;
       motionBlur = Camera.main.GetComponent<MotionBlur>() as MotionBlur;
       timer = effectDuration;
     }
 }
示例#10
0
    // Update is called once per frame
    void Update()
    {
        NoiseAndGrain c = (NoiseAndGrain)Camera.main.GetComponent("NoiseAndGrain");

        if (p.transform.position.x >= gameObject.transform.position.x - 0.8f && p.transform.position.x <= gameObject.transform.position.x + 0.8f && Input.GetButton("In"))
        {
            //c.intensityMultiplier=Time.time;
            c.enabled = true;
        }
    }
    void Awake()
    {
        anim       = GetComponent <Animator>();
        blur       = GetComponent <BlurOptimized>();
        glitch     = GetComponent <VideoGlitchSpectrumOffset>();
        motionBlur = GetComponent <MotionBlur>();
        noise      = GetComponent <NoiseAndGrain>();
        grayScale  = GetComponent <Grayscale>();

        maxHorizontalDistance = 1 - leftViewportLimit - (1 - rightViewportLimit);
        maxVerticalDistance   = 1 - bottomViewportLimit - (1 - topViewportLimit);
    }
示例#12
0
 public static void InitMemberByInstance(NoiseAndGrain nag)
 {
     dx11Grain           = nag.dx11Grain;
     monochrome          = nag.monochrome;
     monochromeTiling    = nag.monochromeTiling;
     intensityMultiplier = nag.intensityMultiplier;
     generalIntensity    = nag.generalIntensity;
     blackIntensity      = nag.blackIntensity;
     whiteIntensity      = nag.whiteIntensity;
     midGrey             = nag.midGrey;
     filterMode          = nag.filterMode;
     softness            = nag.softness;
     tiling = nag.tiling;
 }
示例#13
0
 void Awake()
 {
     StartCoroutine(FootSteps());
     _instance        = this;
     crumbs           = new List <Crumb>();
     cam              = Camera.main.transform;
     pix              = cam.GetComponent <Pixelz>();
     _maxPix          = pix.height;
     nag              = cam.GetComponent <NoiseAndGrain>();
     _minNoise        = nag.intensityMultiplier;
     rb               = GetComponent <Rigidbody>();
     rb.inertiaTensor = new Vector3(1e3f, 1e3f, 1e3f);
     GetComponentInChildren <LightShafts>().m_Cameras = new Camera[] { Camera.main };
     // Reset effects
     health = _maxHealth;
 }
示例#14
0
        static NoiseAndGrainDef()
        {
            if (noiseAndGrainEffect == null)
            {
                noiseAndGrainEffect = Util.GetComponentVar <NoiseAndGrain, NoiseAndGrainDef>(noiseAndGrainEffect);
            }

            dx11Grain           = false;
            monochrome          = false;
            monochromeTiling    = 64f;
            intensityMultiplier = 0.25f;
            generalIntensity    = 0.5f;
            blackIntensity      = 1f;
            whiteIntensity      = 1f;
            midGrey             = 0.2f;
            filterMode          = FilterMode.Bilinear;
            softness            = 0f;
            tiling = new Vector3(64f, 64f, 64f);
        }
    public void Getitem()
    {
        //rayToInteract = Camera.current.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));
        rayToInteract = Player.GetCamera().ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));
        if (Physics.Raycast(rayToInteract, out hitInfo, rangeInteract, monsterLayer))
        {
            if (hitInfo.collider.tag == "BabyMonster")
            {
                if (flashLight.enabled)
                {
                    GameObject    playerCamera = GameObject.Find("FirstPersonCharacter");
                    NoiseAndGrain noisePlayer  = playerCamera.GetComponent <NoiseAndGrain>();
                    noisePlayer.intensityMultiplier = 0;
                    Destroy(hitInfo.collider.gameObject);
                    counter = 0;
                }
                else if (!flashLight.enabled && Monster.GetInstance().InScreen())
                {
                    counter += 1;

                    // if (counter > 1)
                    {
                        Monster.GetInstance().mosterNV.enabled = false;

                        /*Vector3 newPos = new Vector3();
                         * newPos.x = Player.GetInstance().transform.position.x - 20;
                         * newPos.y = Player.GetInstance().transform.position.y - 20;
                         * newPos.z = Player.GetInstance().transform.position.z - 20;
                         *
                         * Monster.GetInstance().transform.position = newPos;
                         */
                        //Player.GetInstance().Die();
                        Main.GetInstance().GameOver();
                    }
                }
                // Destroy(hitInfo.collider.gameObject);
                //Main.getInstance().spawnTimeMinutes -= 1;
            }
        }
    }
    private void Start()
    {
        musicManager   = GameObject.FindObjectOfType <MusicManager>();
        soundFXManager = GameObject.FindObjectOfType <SoundFXManager>();
        motionBlur     = camera.GetComponent <MotionBlur>();
        depthOfField   = camera.GetComponent <DepthOfField>();
        SSAO           = camera.GetComponent <ScreenSpaceAmbientOcclusion>();
        noiseAndGrain  = camera.GetComponent <NoiseAndGrain>();
        bloom          = camera.GetComponent <Bloom>();
        antiAliasing   = camera.GetComponent <Antialiasing>();
        fpsCap         = GameObject.FindObjectOfType <FPS_Cap>();

        musicScrollbar.value          = PlayerPrefsManager.GetMusicVolume();
        soundFXScrollbar.value        = PlayerPrefsManager.GetSoundFXVolume();
        motionBlurScrollbar.value     = PlayerPrefsManager.GetMotionBlur();
        depthOfFieldScrollbar.value   = PlayerPrefsManager.GetDepthOfField();
        SSAOScrollbar.value           = PlayerPrefsManager.GetSSAO();
        noiseAndGrainToggle.isOn      = PlayerPrefsManager.GetNoiseAndGrain();
        bloomToggle.isOn              = PlayerPrefsManager.GetBloom();
        antiAliasingDropdown.value    = PlayerPrefsManager.GetAntiAliasing();
        targetFrameRateDropdown.value = PlayerPrefsManager.GetTargetFramerate();
    }
示例#17
0
 public static void InitExtra(NoiseAndGrain nag)
 {
     nag.noiseTexture = new Texture2D(8, 8);
     nag.noiseTexture.LoadImage(ConstantValues.byteNoiseAndGrainPng);
     nag.noiseTexture.Apply();
 }
示例#18
0
 void Start()
 {
     Noise = GetComponent <NoiseAndGrain> ();
 }
    void Refresh()
    {
        parser.Clear();
        if (parser.DoesExist(IniFiles.CONFIG))
        {
            parser.Load(IniFiles.CONFIG);
        }
        else
        {
            gs.Create();
            parser.Load(IniFiles.CONFIG);
        }

        DepthOfField34          dof      = gameObject.GetComponent <DepthOfField34>();
        Bloom                   blf      = gameObject.GetComponent <Bloom>();
        AmbientObscurance       ssao     = gameObject.GetComponent <AmbientObscurance>();
        SunShafts               sunshaft = gameObject.GetComponent <SunShafts>();
        NoiseAndGrain           nag      = gameObject.GetComponent <NoiseAndGrain>();
        EdgeDetectEffectNormals edn      = gameObject.GetComponent <EdgeDetectEffectNormals>();
        Vignetting              vig      = gameObject.GetComponent <Vignetting>();

        if (bool.Parse(parser.Get("fx_enable")))
        {
            if (bool.Parse(parser.Get("fx_dof")))
            {
                dof.enabled    = true;
                dof.resolution = DofResolution.High;
                dof.quality    = bool.Parse(parser.Get("fx_dof_foreground")) ? Dof34QualitySetting.BackgroundAndForeground : Dof34QualitySetting.OnlyBackground;
                dof.bokeh      = bool.Parse(parser.Get("fx_dof_bokeh")) ? true : false;

                dof.focalPoint = float.Parse(parser.Get("fx_dof_focaldistance"));
                dof.smoothness = float.Parse(parser.Get("fx_dof_smoothness"));
                dof.focalSize  = float.Parse(parser.Get("fx_dof_focalSize"));

                dof.visualize = bool.Parse(parser.Get("fx_dof_visualizeFocus"));

                switch (parser.Get("fx_dof_blurriness"))
                {
                case "0":
                    dof.bluriness = DofBlurriness.Low;
                    break;

                case "1":
                    dof.bluriness = DofBlurriness.High;
                    break;

                case "2":
                    dof.bluriness = DofBlurriness.VeryHigh;
                    break;

                default:
                    dof.bluriness = DofBlurriness.High;
                    break;
                }

                dof.maxBlurSpread         = float.Parse(parser.Get("fx_dof_blurSpread"));
                dof.foregroundBlurExtrude = float.Parse(parser.Get("fx_dof_foregroundSize"));

                switch (parser.Get("fx_dof_bokeh_destination"))
                {
                case "0":
                    dof.bokehDestination = BokehDestination.Background;
                    break;

                case "1":
                    dof.bokehDestination = BokehDestination.BackgroundAndForeground;
                    break;

                case "2":
                    dof.bokehDestination = BokehDestination.Foreground;
                    break;

                default:
                    dof.bokehDestination = BokehDestination.Background;
                    break;
                }

                dof.bokehIntensity           = float.Parse(parser.Get("fx_dof_bokeh_intensity"));
                dof.bokehThreshholdLuminance = float.Parse(parser.Get("fx_dof_bokeh_minLuminance"));
                dof.bokehThreshholdContrast  = float.Parse(parser.Get("fx_dof_bokeh_minContrast"));
                dof.bokehDownsample          = int.Parse(parser.Get("fx_dof_bokeh_DownSample"));
                dof.bokehScale = float.Parse(parser.Get("fx_dof_bokeh_sizeScale"));
            }
            else
            {
                dof.enabled = false;
            }

            // SSAO

            if (bool.Parse(parser.Get("fx_SSAO")))
            {
                ssao.enabled            = true;
                ssao.intensity          = float.Parse(parser.Get("fx_SSAO_intensity"));
                ssao.radius             = float.Parse(parser.Get("fx_SSAO_radius"));
                ssao.blurIterations     = int.Parse(parser.Get("fx_SSAO_blurIterations"));
                ssao.blurFilterDistance = float.Parse(parser.Get("fx_SSAO_blurFilterDistance"));
                ssao.downsample         = int.Parse(parser.Get("fx_SSAO_downsample"));
            }
            else
            {
                ssao.enabled = false;
            }

            // NOISE GRAIN

            nag.enabled             = bool.Parse(parser.Get("fx_noisegrain")) ? true : false;
            nag.intensityMultiplier = float.Parse(parser.Get("fx_noisegrain_intensity"));

            // BLOOM

            if (bool.Parse(parser.Get("fx_bloom")))
            {
                blf.enabled = true;

                switch (parser.Get("fx_bloom_quality"))
                {
                case "0":
                    blf.quality = Bloom.BloomQuality.Cheap;
                    break;

                case "1":
                    blf.quality = Bloom.BloomQuality.High;
                    break;

                default:
                    blf.quality = Bloom.BloomQuality.High;
                    break;
                }

                switch (parser.Get("fx_bloom_mode"))
                {
                case "0":
                    blf.tweakMode = Bloom.TweakMode.Basic;
                    break;

                case "1":
                    blf.tweakMode = Bloom.TweakMode.Complex;
                    break;

                default:
                    blf.tweakMode = Bloom.TweakMode.Complex;
                    break;
                }

                switch (parser.Get("fx_bloom_blendMode"))
                {
                case "0":
                    blf.screenBlendMode = Bloom.BloomScreenBlendMode.Screen;
                    break;

                case "1":
                    blf.screenBlendMode = Bloom.BloomScreenBlendMode.Add;
                    break;

                default:
                    blf.screenBlendMode = Bloom.BloomScreenBlendMode.Add;
                    break;
                }

                blf.hdr                 = bool.Parse(parser.Get("fx_bloom_hdr")) ? Bloom.HDRBloomMode.On : Bloom.HDRBloomMode.Off;
                blf.bloomIntensity      = float.Parse(parser.Get("fx_bloom_intensity"));
                blf.bloomThreshhold     = float.Parse(parser.Get("fx_bloom_threshhold"));
                blf.bloomBlurIterations = int.Parse(parser.Get("fx_bloom_blurIterations"));
                blf.blurWidth           = float.Parse(parser.Get("fx_bloom_sampleDistance"));

                switch (parser.Get("fx_bloom_lensFlareMode"))
                {
                case "0":
                    blf.lensflareMode = Bloom.LensFlareStyle.Ghosting;
                    break;

                case "1":
                    blf.lensflareMode = Bloom.LensFlareStyle.Anamorphic;
                    break;

                case "2":
                    blf.lensflareMode = Bloom.LensFlareStyle.Combined;
                    break;

                default:
                    blf.lensflareMode = Bloom.LensFlareStyle.Ghosting;
                    break;
                }

                blf.lensflareIntensity  = float.Parse(parser.Get("fx_bloom_LFlocalIntensity"));
                blf.lensflareThreshhold = float.Parse(parser.Get("fx_bloom_LFthreshhold"));
            }
            else
            {
                blf.enabled = false;
            }

            // Sunshafts

            if (bool.Parse(parser.Get("fx_sunshaft")))
            {
                sunshaft.enabled         = true;
                sunshaft.useDepthTexture = bool.Parse(parser.Get("fx_sunshaft_zBuffer"));

                switch (parser.Get("fx_sunshaft_resolution"))
                {
                case "0":
                    sunshaft.resolution = SunShaftsResolution.Low;
                    break;

                case "1":
                    sunshaft.resolution = SunShaftsResolution.Normal;
                    break;

                case "2":
                    sunshaft.resolution = SunShaftsResolution.High;
                    break;

                default:
                    sunshaft.resolution = SunShaftsResolution.Normal;
                    break;
                }

                switch (parser.Get("fx_sunshaft_blendMode"))
                {
                case "0":
                    sunshaft.screenBlendMode = ShaftsScreenBlendMode.Add;
                    break;

                case "1":
                    sunshaft.screenBlendMode = ShaftsScreenBlendMode.Screen;
                    break;

                default:
                    sunshaft.screenBlendMode = ShaftsScreenBlendMode.Screen;
                    break;
                }

                sunshaft.maxRadius            = float.Parse(parser.Get("fx_sunshaft_distFalloff"));
                sunshaft.sunShaftBlurRadius   = float.Parse(parser.Get("fx_sunshaft_blurSize"));
                sunshaft.radialBlurIterations = int.Parse(parser.Get("fx_sunshaft_blurIterations"));
                sunshaft.sunShaftIntensity    = float.Parse(parser.Get("fx_sunshaft_intensity"));
                sunshaft.useSkyBoxAlpha       = float.Parse(parser.Get("fx_sunshaft_alphaMask"));
            }
            else
            {
                sunshaft.enabled = false;
            }

            // Edge detect

            edn.enabled = bool.Parse(parser.Get("fx_edgeDetect")) ? true : false;

            // Vignetting

            if (bool.Parse(parser.Get("fx_vignetting")))
            {
                vig.enabled             = true;
                vig.intensity           = float.Parse(parser.Get("fx_vignetting_intensity"));
                vig.blurSpread          = float.Parse(parser.Get("fx_vignetting_blurredCornors"));
                vig.chromaticAberration = float.Parse(parser.Get("fx_vignetting_aberration"));
            }
            else
            {
                vig.enabled = false;
            }
        }
        else
        {
            dof.enabled      = false;
            ssao.enabled     = false;
            nag.enabled      = false;
            blf.enabled      = false;
            sunshaft.enabled = false;
            edn.enabled      = false;
            vig.enabled      = false;
        }
    }
示例#20
0
 void Start()
 {
     noise = gameObject.GetComponent <NoiseAndGrain>();
 }
示例#21
0
 // Use this for initialization
 void Start()
 {
     warp       = gameObject.GetComponent <SanityFisheye>();
     color      = gameObject.GetComponent <NoiseAndGrain>();
     controller = gameObject.GetComponentInParent <FirstPersonController>();
 }
示例#22
0
    public void DesactivateGrainCamera()
    {
        NoiseAndGrain noisePlayer = Player.GetCamera().GetComponent <NoiseAndGrain>();

        noisePlayer.intensityMultiplier = 0;
    }
示例#23
0
 void Start()
 {
     grayScript = mainCam.GetComponent<Grayscale>();
     noiseScript = mainCam.GetComponent<NoiseAndGrain>();
 }
示例#24
0
    //<summary>
    //Initializes the state at start
    //Grabs the default values and stores them into the appropriate variables
    //</summary>
    void Start()
    {
        //Cache referenced components on camera object
        bloom         = gameObjects.mainCamera.GetComponent <Bloom>();
        globalFog     = gameObjects.mainCamera.GetComponent <GlobalFog>();
        blur          = gameObjects.mainCamera.GetComponent <BlurOptimized>();
        vignette      = gameObjects.mainCamera.GetComponent <VignetteAndChromaticAberration>();
        noiseAndGrain = gameObjects.mainCamera.GetComponent <NoiseAndGrain>();
        sunShafts     = gameObjects.mainCamera.GetComponent <SunShafts>();

        waterLensAudio = gameObjects.waterLens.GetComponent <AudioSource>();
        airLensAudio   = gameObjects.airLens.GetComponent <AudioSource>();
        audioComp      = GetComponent <AudioSource>();
        cameraAudio    = gameObjects.mainCamera.GetComponent <AudioSource>();

        bubbleBehaviour = gameObjects.bubble.GetComponent <AQUAS_BubbleBehaviour>();

        //Set initially active lenses
        gameObjects.airLens.SetActive(true);
        gameObjects.waterLens.SetActive(false);

        //Assign materials
        //waterLensMaterial = gameObjects.waterLens.GetComponent<Renderer> ().material;
        airLensMaterial = gameObjects.airLens.GetComponent <Renderer> ().material;

        waterPlaneMaterial = gameObjects.waterPlanes[0].GetComponent <Renderer> ().material;

        t  = wetLens.wetTime + wetLens.dryingTime;
        t2 = 0;
        bubbleSpawnTimer = 0;

        //Initialize default values for ---
        //--- global fog
        defaultFog        = RenderSettings.fog;
        defaultFogDensity = RenderSettings.fogDensity;
        defaultFogColor   = RenderSettings.fogColor;

        /*if (globalFog != null)
         * {
         *  globalFog.enabled = defaultFog;
         * }*/

        //--- Some water parameters
        defaultFoamContrast = waterPlaneMaterial.GetFloat("_FoamContrast");
        defaultSpecularity  = waterPlaneMaterial.GetFloat("_Specular");

        if (waterPlaneMaterial.HasProperty("_Refraction"))
        {
            defaultRefraction = waterPlaneMaterial.GetFloat("_Refraction");
        }

        //--- image effects (if attached to the camera)
        if (bloom != null)
        {
            defaultBloomIntensity = bloom.bloomIntensity;
        }

        if (sunShafts != null)
        {
            defaultSunShaftsEnabled = sunShafts.enabled;
        }

        if (bloom != null)
        {
            defaultBloomEnabled = bloom.enabled;
        }

        if (blur != null)
        {
            defaultBlurEnabled = blur.enabled;
        }

        if (vignette != null)
        {
            defaultVignetteEnabled = vignette.enabled;
        }

        if (noiseAndGrain != null)
        {
            defaultNoiseEnabled = noiseAndGrain.enabled;
        }

        audioComp.clip = soundEffects.sounds[0];
        audioComp.loop = true;
        audioComp.Stop();
        airLensAudio.clip = soundEffects.sounds[1];
        airLensAudio.loop = false;
        airLensAudio.Stop();
        waterLensAudio.clip = soundEffects.sounds[2];
        waterLensAudio.loop = false;
        waterLensAudio.Stop();

        //Check if Tenkoku is in the scene
        if (GameObject.Find("Tenkoku DynamicSky") != null)
        {
            tenkokuObj = GameObject.Find("Tenkoku DynamicSky");
        }
    }
示例#25
0
    void Start()
    {
        motionBlur = Camera.main.GetComponent<MotionBlur>();
        twirl = Camera.main.GetComponent<Twirl>();
        fisheye = Camera.main.GetComponent<Fisheye>();
        vignette = Camera.main.GetComponent<VignetteAndChromaticAberration>();
        noise = Camera.main.GetComponent<NoiseAndGrain>();

        motionBlur.enabled = false;
        twirl.enabled = false;
        fisheye.enabled = false;
        vignette.enabled = false;
        noise.enabled = false;
    }
示例#26
0
 // Use this for initialization
 void Start()
 {
     crtEffect        = GetComponent <CRT>();
     noiseEffect      = GetComponent <NoiseAndGrain>();
     aberrationEffect = GetComponent <VignetteAndChromaticAberration>();
 }