Esempio n. 1
0
 protected override void Awake()
 {
     if (!postProcessingProfile.TryGet <T>(out setting))            //Try to get the setting
     {
         setting = postProcessingProfile.Add <T>(true);             //Create it if it can't be found
     }
     base.Awake();
 }
Esempio n. 2
0
 void GetVolumetricCloudVolume(VolumeProfile profile, out VolumetricClouds volumetricClouds)
 {
     volumetricClouds = null;
     if (profile != null)
     {
         profile.TryGet <VolumetricClouds>(out volumetricClouds);
     }
 }
Esempio n. 3
0
        private void ToggleEffect <T>(bool enabled) where T : VolumeComponent
        {
            T component;

            if (postProcessProfile.TryGet(out component))
            {
                component.active = enabled;
            }
        }
Esempio n. 4
0
    //
    public void SetBloom(bool value)
    {
        Bloom bloom;

        bloomVp.TryGet(out bloom);
        bloom.active = value;
        //bloom.intensity.value = 0.5f;
        //bloom.intensity.Override(0.5f);
    }
    // Update is called once per frame
    void Update()
    {
        ColorAdjustments adjustments;

        if (profile.TryGet <ColorAdjustments>(out adjustments))
        {
            adjustments.hueShift.value += Time.deltaTime * 10;
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        VolumeProfile volumeProfile = GetComponent <Volume>().profile;

        if (!volumeProfile.TryGet(out vignette))
        {
            throw new System.NullReferenceException(nameof(vignette));
        }
    }
Esempio n. 7
0
 private void Awake()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
         return;
     }
     Instance       = this;
     Cursor.visible = false;
     DontDestroyOnLoad(gameObject);
     DefaultSVP.TryGet(out _bloom);
     DefaultSVP.TryGet(out _lensDistortion);
     _camera = Camera.main;
     SceneManager.sceneLoaded += OnSceneLoaded;
     CurrentOptions            = new Options(DefaultOptions);
     SetColorPalette(CurrentOptions.colorPalette);
     ColorPaletteCollection = DefaultColorPaletteCollection;
 }
Esempio n. 8
0
    public void Update()
    {
        Vignette         lVignette;
        ColorAdjustments lColorAdjustments;

        if (mVPBlackVeil.TryGet(out lVignette))
        {
            float lClampedValue   = Mathf.Max(depthEvent.sentFloat / playerData.maxDepth, 0.3f);
            float lIntensityRange = Mathf.InverseLerp(0.0f, 1.0f, lClampedValue);
            lVignette.intensity.value = Mathf.InverseLerp(0.0f, 0.6f, lIntensityRange);
        }

        if (mVPBlackVeil.TryGet(out lColorAdjustments))
        {
            float lClampedValue = Mathf.Max(depthEvent.sentFloat / playerData.maxDepth, 0.5f);
            float lColorRange   = Mathf.InverseLerp(0.0f, 1.0f, lClampedValue);
            lVignette.intensity.value = Mathf.InverseLerp(0.5f, 1.0f, lColorRange);
        }
    }
Esempio n. 9
0
    public void Update()
    {
        if (mCurrentTimerValue < mMaxTimerValue)
        {
            mCurrentTimerValue += Time.deltaTime;
            mCurrentTimerValue  = Mathf.Clamp(mCurrentTimerValue, 0.0f, mMaxTimerValue);
        }
        else
        {
            mCurrentTimerValue = 0.0f;
            mShiftUp           = !mShiftUp;
        }
        //Shift move between 0.0f and 1.0f
        float lShift;

        if (mShiftUp)
        {
            lShift = Mathf.InverseLerp(0.0f, mMaxTimerValue, mCurrentTimerValue);
        }
        else
        {
            lShift = Mathf.InverseLerp(mMaxTimerValue, 0.0f, mCurrentTimerValue);
        }

        LiftGammaGain  lLiftGammaGain;
        LensDistortion lLensDistortion;
        float          lMentalHealth = mentalHealthEvent.sentFloat / playerData.maxHealth;

        if (mVPMentalHealth.TryGet(out lLiftGammaGain))
        {
            // Change intensity between -mLensShift and mLensShift
            float lGammaShift = ((lShift * mLensShift - 1.0f) * mLensShift) * (1.0f - lMentalHealth);
            lGammaShift = Mathf.Clamp(lGammaShift, -mLensShift, mLensShift);
            lLiftGammaGain.gamma.value = new Vector4(1.0f, 1.0f, 1.0f, lGammaShift);
        }
        if (mVPMentalHealth.TryGet(out lLensDistortion))
        {                                               // Change intensity between -mGammaDistorionShift and +mGammaDistorionShift
            float lIntensityShift = (lShift * 2.0f * mGammaDistorionShift - mGammaDistorionShift) * (1.0f - lMentalHealth);
            lIntensityShift = lIntensityShift / 100.0f; // URP PP use [-1;1] range
            lIntensityShift = Mathf.Clamp(lIntensityShift, -mGammaDistorionShift, mGammaDistorionShift);
            lLensDistortion.intensity.value = lIntensityShift;
        }
    }
Esempio n. 10
0
    void Start()
    {
        inSlowMo = false;
        slowMoEffectCurrentState = 0;
        slowMoEffectActive       = false;
        slowMoProfile            = Instantiate(slowMoStartProfile);

        slowMoProfile.TryGet <ChromaticAberration>(out chromaticAberration);
        slowMoProfile.TryGet <LensDistortion>(out lensDistortion);
        slowMoProfile.TryGet <Vignette>(out vignette);

        chromaticAberration = Instantiate(chromaticAberration);
        lensDistortion      = Instantiate(lensDistortion);
        vignette            = Instantiate(vignette);

        for (int i = 0; i < slowMoProfile.components.Count; i++)
        {
            switch (slowMoProfile.components[i].name)
            {
            case "ChromaticAberration":
                slowMoProfile.components[i] = chromaticAberration;
                break;

            case "Vignette":
                slowMoProfile.components[i] = vignette;
                break;

            case "LensDistortion":
                slowMoProfile.components[i] = lensDistortion;
                break;
            }
        }

        chromaticAberration.intensity.overrideState = true;
        vignette.intensity.overrideState            = true;
        lensDistortion.intensity.overrideState      = true;

        aberrationBaseIntensity = chromaticAberration.intensity.value;
        distortionBaseIntensity = lensDistortion.intensity.value;
        vignetteBaseIntensity   = vignette.intensity.value;
    }
Esempio n. 11
0
    public void Initialize()
    {
        _initialized = true;

        if (!postProcessingProfile.TryGet(out adjustmentsEffect))
        {
            Debug.LogError("Post Processing profile does not have Color Adjustments effect!");
        }

        GetSettingValues();
        ApplyAll();
    }
Esempio n. 12
0
    private void Start()
    {
        StartCoroutine(GetSettingsWhenInitialized());
        cubemapEventListenerSet = onCubemapUpdate.GetPersistentEventCount() > 0;
        HDCameraData            = XRCamera.GetComponent <HDAdditionalCameraData>();

        if (!m_skyboxProfile.TryGet(out volumeSky))
        {
            volumeSky = m_skyboxProfile.Add <HDRISky>(true);
        }

        if (!m_skyboxProfile.TryGet(out volumeExposure))
        {
            volumeExposure = m_skyboxProfile.Add <Exposure>(true);
        }

        if (!m_skyboxProfile.TryGet(out volumeVSTWhiteBalance))
        {
            volumeVSTWhiteBalance = m_skyboxProfile.Add <VSTWhiteBalance>(true);
        }
    }
Esempio n. 13
0
    void Start()
    {
        DontDestroyOnLoad(GameObject.FindGameObjectWithTag("PP"));
        v = GameObject.FindGameObjectWithTag("PP").GetComponent <Volume>()?.profile;
        v.TryGet(out vg);

        dotSpawner = DotSpawner.instance;
        OpenUp     = GameObject.FindGameObjectWithTag("OpenUP").GetComponent <ShowThis>();
        target     = GameObject.FindGameObjectWithTag("Player").transform;

        Recolour(saturation, brightness);
    }
Esempio n. 14
0
 public static void SetFocusDistance(float value)
 {
     if (_volume.TryGet(out _depthOfField))
     {
         _depthOfField.focusDistance.value = value;
     }
 }
    private void Start()
    {
        originalOpaqueValue = VarjoRendering.GetOpaque();
        VarjoRendering.SetOpaque(false);
        cubemapEventListenerSet = onCubemapUpdate.GetPersistentEventCount() > 0;
        HDCameraData            = xrCamera.GetComponent <HDAdditionalCameraData>();

        if (!m_skyboxProfile.TryGet(out volumeSky))
        {
            volumeSky = m_skyboxProfile.Add <HDRISky>(true);
        }

        if (!m_skyboxProfile.TryGet(out volumeExposure))
        {
            volumeExposure = m_skyboxProfile.Add <Exposure>(true);
        }

        if (!m_skyboxProfile.TryGet(out volumeVSTWhiteBalance))
        {
            volumeVSTWhiteBalance = m_skyboxProfile.Add <VSTWhiteBalance>(true);
        }
    }
Esempio n. 16
0
        private void Awake()
        {
            instance = this;

            Cursor.visible   = false;
            Cursor.lockState = CursorLockMode.Locked;

            anim         = GetComponent <Animator>();
            input        = GetComponent <MovementInput>();
            originalZoom = thirdPersonCam.m_Orbits[1].m_Radius;
            impulse      = thirdPersonCam.GetComponent <CinemachineImpulseSource>();

            postProfile = postVolume.profile;
            postProfile.TryGet(out colorAdjustments);
            postProfile.TryGet(out chromaticAberration);
            postProfile.TryGet(out vignette);

            gunIdlePos = gun.localPosition;
            gunIdleRot = gun.localEulerAngles;

            HorizontalOffset(originalOffsetAmount);
        }
    protected virtual void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        volumeProfile = GetComponent <Volume>()?.profile;
        volumeProfile.TryGet(out vignette);
    }
Esempio n. 18
0
    private void Awake()
    {
        if (introVolume != null)
        {
            profile = introVolume.profile;
            profile.TryGet <DepthOfField>(out dof);
        }
        else
        {
            LogUtils.LogWarning("Intro profile was not found! Make sure it is hooked up in the inspector.");
        }

        InitIntro();
    }
Esempio n. 19
0
    // Start is called before the first frame update
    void Start()
    {
        anim         = this.GetComponent <Animator>();
        input        = this.GetComponent <MoveController>();
        aimControl   = this.GetComponent <AimController>();
        swordControl = this.GetComponent <SwordController>();
        skinMeshList = GetComponentsInChildren <SkinnedMeshRenderer>();

        impulse = FindObjectOfType <CinemachineFreeLook>().GetComponent <CinemachineImpulseSource>();
        Volume        postVolume  = FindObjectOfType <Volume>();
        VolumeProfile postProfile = postVolume.profile;

        postProfile.TryGet <LensDistortion>(out distorsion);
    }
Esempio n. 20
0
        /// <summary>
        /// Sets fog back to default
        /// </summary>
        private void OnDisable()
        {
            if (m_currentRenderer == GaiaConstants.EnvironmentRenderer.HighDefinition2018x)
            {
#if HDPipeline
                if (volume != null)
                {
                    VolumeProfile profile = volume.sharedProfile;
                    if (profile != null)
                    {
                        VisualEnvironment environment;
                        if (profile.TryGet(out environment))
                        {
                            environment.fogType.value = FogType.Volumetric;
                        }

                        VolumetricFog fog;
                        if (profile.TryGet(out fog))
                        {
                            fog.active = true;
                        }

                        LinearFog linearFog;
                        if (profile.TryGet(out linearFog))
                        {
                            linearFog.active = false;
                        }
                    }
                }
#endif
            }
            else
            {
                RenderSettings.fogColor       = storedFogColor;
                RenderSettings.fogEndDistance = storedFogDistance;
            }
        }
Esempio n. 21
0
 void GetCloudFromVolume(VolumeProfile profile, out CloudLayer cloudLayer)
 {
     if (profile != null)
     {
         profile.TryGet(out cloudLayer);
         if (cloudLayer != null && !cloudLayer.active)
         {
             cloudLayer = null;
         }
     }
     else
     {
         cloudLayer = null;
     }
 }
Esempio n. 22
0
 void Update()
 {
     if (volumeProfile == null)
     {
         return;
     }
     if (zoomBlur == null)
     {
         volumeProfile.TryGet <Dither>(out zoomBlur);
     }
     if (zoomBlur == null)
     {
         return;
     }
 }
Esempio n. 23
0
    private void Awake()
    {
        VolumeProfile volumeProfile = GetComponent <Volume>()?.profile;

        if (!volumeProfile)
        {
            throw new System.NullReferenceException(nameof(VolumeProfile));
        }

        if (!volumeProfile.TryGet(out vignette))
        {
            throw new System.NullReferenceException(nameof(vignette));
        }

        vignette.intensity.Override(0.37f);
    }
Esempio n. 24
0
    private void Awake()
    {
        input = FindObjectOfType <InputManager>();
        Assert.IsNotNull(input, "InputManager not found.");
        timeManager = FindObjectOfType <TimeManager>();
        Assert.IsNotNull(input, "TimeManager not found.");

        ray     = GetComponent <RayFromCamera>();
        player  = GetComponent <RewindablePlayer>();
        carrier = GetComponent <Carrier>();

        VolumeProfile volumeProfile = Camera.main.GetComponent <Volume>().profile;

        volumeProfile.TryGet <ChromaticAberration>(out chromaticAberration);
        rewindCountdownText = rewindCountdown.GetComponentInChildren <TextMeshProUGUI>();
    }
Esempio n. 25
0
    void Start()
    {
        //Make cross compatible with PC and mobile
        Input.simulateMouseWithTouches = true;

        mainCam           = FindObjectOfType <Camera>();
        playerRigidbody2D = GetComponent <Rigidbody2D>();
        playerTransform   = GetComponent <Transform>();
        aM = AudioManager.instance;

        //Get access to postprocessing vignette
        v = GameObject.FindGameObjectWithTag("PP").GetComponent <Volume>()?.profile;
        v.TryGet(out vg);

        pitchDownRoutine = null;
        pitchUpRoutine   = null;
    }
Esempio n. 26
0
            public VolumeData(bool isGlobal, VolumeProfile profile)
            {
                this.isGlobal = isGlobal;
                this.profile  = profile;
                VisualEnvironment visualEnvironment = null;

                this.hasVisualEnvironment = profile != null?profile.TryGet <VisualEnvironment>(typeof(VisualEnvironment), out visualEnvironment) : false;

                if (this.hasVisualEnvironment)
                {
                    this.skyType = (SkyType)visualEnvironment.skyType.value;
                    this.fogType = visualEnvironment.fogType.value;
                }
                else
                {
                    this.skyType = (SkyType)1;
                    this.fogType = (FogType)0;
                }
            }
Esempio n. 27
0
            public VolumeData(bool isGlobal, VolumeProfile profile, bool hasStaticLightingSky)
            {
                this.isGlobal = isGlobal;
                this.profile  = profile;
                VisualEnvironment visualEnvironment = null;

                this.hasVisualEnvironment = profile.TryGet <VisualEnvironment>(typeof(VisualEnvironment), out visualEnvironment);
                if (this.hasVisualEnvironment)
                {
                    this.skyType = (SkyType)visualEnvironment.skyType.value;
                    this.fogType = visualEnvironment.fogType.value;
                }
                else
                {
                    this.skyType = (SkyType)1;
                    this.fogType = (FogType)0;
                }
                this.hasStaticLightingSky = hasStaticLightingSky;
            }
Esempio n. 28
0
    private IEnumerator EndCreditsAnimation()
    {
        float time        = 4;
        float elapsedTime = 0;

        volume.TryGet(out vignette); //Grab the value of the post processing effect

        while (elapsedTime < time)
        {
            vignette.intensity.Override(Mathf.Lerp(((float)vignette.intensity), 1, (elapsedTime / time))); //override the effect that you want with the value you need.
            elapsedTime += Time.deltaTime;
            yield return(null);
        }

        GameStateManager.StartMenu();
        yield return(new WaitForSeconds(0.1f));

        SceneLoader.LoadMainScene();
    }
        protected override void PostPipelineStageCallback(
            CinemachineVirtualCameraBase vcam,
            CinemachineCore.Stage stage, ref CameraState state, float deltaTime)
        {
            // Set the focus after the camera has been fully positioned.
            // GML todo: what about collider?
            if (stage == CinemachineCore.Stage.Aim)
            {
                if (!IsValid)
                {
                    DestroyProfileCopy();
                }
                else
                {
                    // Handle Follow Focus
                    if (!m_FocusTracksTarget)
                    {
                        DestroyProfileCopy();
                    }
                    else
                    {
                        if (mProfileCopy == null || mCachedProfileIsInvalid)
                        {
                            CreateProfileCopy();
                        }

                        DepthOfField dof;
                        if (m_Profile.TryGet(out dof))
                        {
                            float focusDistance = m_FocusOffset;
                            if (state.HasLookAt)
                            {
                                focusDistance += (state.FinalPosition - state.ReferenceLookAt).magnitude;
                            }
                            dof.focusDistance.value = Mathf.Max(0, focusDistance);
                        }
                    }
                    // Apply the post-processing
                    state.AddCustomBlendable(new CameraState.CustomBlendable(this, 1));
                }
            }
        }
    void Update()
    {
        if (volumeProfile == null)
        {
            return;
        }
        if (zoomBlur == null)
        {
            volumeProfile.TryGet <ZoomBlur>(out zoomBlur);
        }
        if (zoomBlur == null)
        {
            return;
        }

        zoomBlur.focusPower.value           = focusPower;
        zoomBlur.focusDetail.value          = focusDetail;
        zoomBlur.focusScreenPosition.value  = focusScreenPosition;
        zoomBlur.referenceResolutionX.value = referenceResolutionX;
    }