Inheritance: ImageEffectBase
示例#1
0
 void Start()
 {
     chromatic = ScriptableObject.CreateInstance <ChromaticAberration>();
     chromatic.enabled.Override(true);
     chromatic.intensity.Override(currentChromaticIntensity);
     volumeChromatic = PostProcessManager.instance.QuickVolume(gameObject.layer, 100f, chromatic);
 }
示例#2
0
    //private float vignetteInit = 0f;
    private void Awake()
    {
        playerAudio = GetComponent <PlayerAudio>();
        //postProcessing = FindObjectOfType<Volume>().GetComponent<Animator>();
        volume = FindObjectOfType <Volume>();

        if (volume.profile.TryGet <LensDistortion>(out var lens))
        {
            distortion = lens;
        }
        if (volume.profile.TryGet <ColorAdjustments>(out var postColors))
        {
            colors = postColors;
        }
        if (volume.profile.TryGet <ChromaticAberration>(out var chrom))
        {
            chromatic     = chrom;
            chromaticInit = chrom.intensity.value;
        }

        /*
         * if (volume.profile.TryGet<Vignette>(out var vin))
         * {
         *  vignette = vin;
         *  vignetteInit = vin.intensity.value;
         * }*/
    }
示例#3
0
    void Palpitations()
    {
        if (palLevel < 0)
        {
            palMode = true;
        }
        else if (palLevel > 0.2f)
        {
            palMode = false;
        }

        if (palMode == true)
        {
            palLevel += palSpeed;
        }
        else
        {
            palLevel -= palSpeed;
        }

        ChromaticAberration c = ScriptableObject.CreateInstance <ChromaticAberration>();

        c.enabled.Override(true);
        c.intensity.Override(palLevel);

        Vignette v = ScriptableObject.CreateInstance <Vignette>();

        v.color.Override(new Color(0.65f, 0.37f, 0.37f));
        v.enabled.Override(true);
        v.intensity.Override(palLevel);

        PostProcessEffectSettings[] p = { c, v };

        PostProcessVolume postProcessVolume = PostProcessManager.instance.QuickVolume(Camera.main.gameObject.layer, 0f, p);
    }
    public IEnumerator SlowTimeEffect()
    {
        IsSlowDownCurrentlyRunning = true;
        var prevTimeScale = GameManager.Instance.TimeScale;

        GameManager.Instance.TimeScale = _slowdownTimeScale;

        PostProcessVolume   vol   = FindObjectOfType <PostProcessVolume>();
        Bloom               bloom = null;
        ChromaticAberration CA    = null;

        vol.profile.TryGetSettings(out bloom);
        vol.profile.TryGetSettings(out CA);
        bloom.intensity.value = 15;
        CA.intensity.value    = 0.4f;

        yield return(new WaitForSeconds(_slowdownDuration));

        bloom.intensity.value = 7.5f;
        CA.intensity.value    = 0.1f;

        GameManager.Instance.TimeScale = prevTimeScale;
        yield return(new WaitForSeconds(_slowdownCooldownDuration));

        IsSlowDownCurrentlyRunning = false;
    }
示例#5
0
 void Awake()
 {
     m_Vignette = postProcessProfile.GetSetting <Vignette>();
     m_Vignette.intensity.value           = 0;
     m_ChromaticAberation                 = postProcessProfile.GetSetting <ChromaticAberration>();
     m_ChromaticAberation.intensity.value = 0;
 }
    protected virtual void Start()
    {
        bloom = volume.profile.GetSetting <Bloom>();
        chromaticAberration = volume.profile.GetSetting <ChromaticAberration>();
        colorGrading        = volume.profile.GetSetting <ColorGrading>();
        vignette            = volume.profile.GetSetting <Vignette>();

        //Set Min values
        if (bloom)
        {
            minBloomIntensity = bloom.intensity.value;
        }
        if (vignette)
        {
            minVignetteIntensity = vignette.intensity.value;
        }
        if (chromaticAberration)
        {
            minChromaticIntensity = chromaticAberration.intensity.value;
        }
        if (colorGrading)
        {
            minPostExposure  = colorGrading.postExposure.value;
            minSaturation    = colorGrading.saturation.value;
            minContrast      = colorGrading.contrast.value;
            startColorFilter = colorGrading.colorFilter.value;
        }
    }
示例#7
0
    private ChromaticAberration _chromAbr;  // Chromatic Aberration

    // -----------------------------------------------------------------------------
    // METHOD:      Awake()
    // DESCRIPTION: Cache global variables, set up audio sources. Creates a
    //              postProcessing volume with a vignette and chromatic abbration
    //              which are used for extra feedback when player is hit/low on health
    // -------------------------------------------------------------------------------
    private void Awake()
    {
        // Code to get player hurt audio sources:
        AudioSource[] sources = PlayerAudio.GetComponents <AudioSource>();
        PlayerHurt        = sources[0];
        HeartBeatSource   = sources[1];
        BreathSource      = sources[2];
        _playerDeathMusic = sources[3];
        _gainHealthAudio  = sources[4];

        _moveScript              = GetComponent <MoveScript>();
        _mouseLook               = GetComponentInChildren <MouseLook>();
        _playerAnim              = GetComponentInChildren <Animator>();
        LevelManager             = FindObjectOfType <LevelManager>();
        PlayerStats.PlayerHealth = 100.0f; // Make sure the player is beginning the game with full health


        // Added a conditional for the value assignment because there is no health slider in the start area scene
        if (_healthSlider)
        {
            _healthSlider.value = PlayerStats.PlayerHealth;
        }
        // Set up the post processing volume:
        _playerVignette = ScriptableObject.CreateInstance <Vignette>(); // create the vignette
        _playerVignette.enabled.Override(true);
        _playerVignette.intensity.Override(0.0f);
        _chromAbr = ScriptableObject.CreateInstance <ChromaticAberration>(); // Create and set up chromatic abb
        _chromAbr.enabled.Override(true);
        _chromAbr.intensity.Override(0.0f);
        _ppVolume = PostProcessManager.instance.QuickVolume(gameObject.layer, 100f, _playerVignette, _chromAbr); // assign the pp Volume
    }
示例#8
0
    // Use this for initialization
    void Start()
    {
        fpsCounterText = fpsCounterLabel.GetComponent <Text>();

        _timerText      = TimerText.GetComponent <Text>();
        _nodeTypeText   = nodeTypeLabel.GetComponent <Text>();
        _nodeChanceText = nodeChanceLabel.GetComponent <Text>();

        progressBarRectTrans      = progressBar.GetComponent <RectTransform>();
        progressBarImageComponent = progressBar.GetComponent <Image>();
        progressBarReferenceWidth = progressBarRectTrans.rect.width;

        actionCountersTextComponets = new Text[actionCounters.Length];
        for (int i = 0; i < actionCounters.Length; i++)
        {
            actionCountersTextComponets[i] = actionCounters[i].GetComponent <Text>();
        }

        scoreCountersTextComponents = new Text[scoreCounters.Length];
        for (int i = 0; i < scoreCounters.Length; i++)
        {
            scoreCountersTextComponents[i] = scoreCounters[i].GetComponent <Text>();
        }

        aberrationDuration = GameManager.GetStopDuration();
        aberration         = Camera.main.GetComponent <ChromaticAberration>();

        hudLoadTime = Time.time;
        thisHud     = this;
    }
示例#9
0
 void Awake()
 {
     chromaticAberration = profile.GetSetting <ChromaticAberration>();
     ambientOcclusion    = profile.GetSetting <AmbientOcclusion>();
     grain          = profile.GetSetting <Grain>();
     lensDistortion = profile.GetSetting <LensDistortion>();
 }
示例#10
0
    void Start()
    {
        if (GetComponent <ScriptManager>().ArmsCamera.GetComponent <PostProcessVolume>())
        {
            postProcessing = GetComponent <ScriptManager>().ArmsCamera.GetComponent <PostProcessVolume>();

            if (postProcessing.profile.HasSettings <ChromaticAberration>())
            {
                chromatic = postProcessing.profile.GetSetting <ChromaticAberration>();
            }
            else
            {
                Debug.LogError($"[PostProcessing] Please add Chromatic Aberration Effect to a {postProcessing.profile.name} profile in order to use Jumpscare Effects!");
            }

            if (postProcessing.profile.HasSettings <Vignette>())
            {
                vignette = postProcessing.profile.GetSetting <Vignette>();
            }
            else
            {
                Debug.LogError($"[PostProcessing] Please add Vignette Effect to a {postProcessing.profile.name} profile in order to use Jumpscare Effects!");
            }
        }
        else
        {
            Debug.LogError($"[PostProcessing] There is no PostProcessVolume script added to a {GetComponent<ScriptManager>().ArmsCamera.gameObject.name}!");
        }

        itemSwitcher = GetComponentInChildren <ItemSwitcher>();

        PlayerBreath  = transform.root.gameObject.GetComponentInChildren <PlayerController>().transform.GetChild(1).transform.GetChild(1).gameObject.GetComponent <AudioSource>();
        defaultVolume = PlayerBreath.volume;
    }
示例#11
0
    void Start()
    {
        //
        haveKey        = false;
        chromaticLayer = ScriptableObject.CreateInstance <ChromaticAberration>();
        lensLayer      = ScriptableObject.CreateInstance <LensDistortion>();
        depthLayer     = ScriptableObject.CreateInstance <DepthOfField>();
        postProcess    = post.GetComponent <PostProcessVolume>();
        audio          = GetComponent <AudioSource>();

        FearBar  = FearBarObject.GetComponent <Slider>();
        LiferBar = LifeBarObject.GetComponent <Slider>();

        persecution       = false;
        depthLayer.active = false;
        postProcess.profile.TryGetSettings(out chromaticLayer);
        postProcess.profile.TryGetSettings(out lensLayer);
        postProcess.profile.TryGetSettings(out depthLayer);
        contador = 0;
        isDead   = false;
        life     = 100;
        fear     = 0;
        temp     = 0;
        temp2    = 0;
    }
    public IEnumerator ChromaticAberr(float duration, float biasTowardEnd)
    {
        float timer = 0;

        biasTowardEnd = Mathf.Clamp01(biasTowardEnd);
        Debug.Log("Bias: " + biasTowardEnd);
        float rampUpDuration   = duration * (1 - biasTowardEnd);
        float rampDownDuration = duration * biasTowardEnd;


        ChromaticAberration chromComp = null;

        Debug.Log(volumeProfile.ToString());
        foreach (VolumeComponent component in volumeProfile.components)
        {
            if (component.GetType() == typeof(ChromaticAberration))
            {
                Debug.Log("Is chromatic aberration");
                chromComp = (ChromaticAberration)component;
                chromComp.intensity.Override(1f);
            }
        }

        while (timer < rampUpDuration)
        {
            timer += Time.deltaTime;

            if (chromComp == null)
            {
                timer += duration;
                yield return(null);
            }

            float lerpT = Mathf.InverseLerp(0, rampUpDuration, timer);

            chromComp.intensity.Override(lerpT);

            yield return(new WaitForSeconds(0f));
        }

        timer = 0;
        while (timer < rampDownDuration)
        {
            timer += Time.deltaTime;

            if (chromComp == null)
            {
                timer += duration;
                yield return(null);
            }

            float lerpT = Mathf.InverseLerp(rampDownDuration, 0, timer);

            chromComp.intensity.Override(lerpT);

            yield return(new WaitForSeconds(0f));
        }

        yield return(null);
    }
示例#13
0
 private void ReloadCamera()
 {
     _camera                    = Camera.main;
     _volume                    = _camera.GetComponent <PostProcessVolume>();
     _shaderColorGrading        = _volume.profile.GetSetting <ColorGrading>();
     _shaderDepthOfField        = _volume.profile.GetSetting <DepthOfField>();
     _shaderChromaticAberration = _volume.profile.GetSetting <ChromaticAberration>();
 }
示例#14
0
    private void Awake()
    {
        Camera = GetComponentInChildren <Camera>();

        _chromaticAberration = Camera.GetComponent <PostProcessVolume>().sharedProfile.GetSetting <ChromaticAberration>();
        _controller          = GetComponent <CharacterController>();
        _height = transform.position.y;
    }
示例#15
0
 protected override void Awake()
 {
     if (!postProcessingProfile.TryGetSettings <ChromaticAberration>(out ca))           //Try to get the setting override
     {
         ca = postProcessingProfile.AddSettings <ChromaticAberration>();                //Create one if it can't be found
     }
     base.Awake();
 }
示例#16
0
    private void Awake()
    {
        _cpMain  = transform.parent.GetComponent <CpMain>();
        _caBoost = transform.parent.GetComponent <CaBoost>();

        _chromaticAberration = _profile.GetSetting <ChromaticAberration>();
        _lensDistortion      = _profile.GetSetting <LensDistortion>();
    }
    public void FinishStar()
    {
        ChromaticAberration ca = ScriptableObject.CreateInstance <ChromaticAberration>();

        ca.enabled.Override(true);
        ca.intensity.Override(0);
        ppv = PostProcessManager.instance.QuickVolume(gameObject.layer, 0f, ca);
    }
示例#18
0
    void applyPostProccesing()
    {
        aberration = ScriptableObject.CreateInstance <ChromaticAberration>();
        aberration.enabled.Override(true);
        aberration.intensity.Override(1f);

        Variable.shakeCam = true;
        Destroy(PostProcessManager.instance.QuickVolume(GameObject.Find("PPV").layer, 100f, aberration), vars.destroyEffecttime);
    }
示例#19
0
    private void Start()
    {
        ChromaticAberration tmp;

        if (volume.profile.TryGet(out tmp))
        {
            chrom = tmp;
        }
    }
        public SimpleCameraShake shake;                                     // the reference to our camera shake script on the MainCam

        void Awake()
        {
            //cache a reference to this gameObject.
            thisGameObject = this.gameObject;

            //Setup Shake and Chroma Script References... both scripts are on the main camera
            shake  = Camera.main.GetComponent <SimpleCameraShake>();
            chroma = Camera.main.GetComponent <ChromaticAberration>();
        }
示例#21
0
        void Start()
        {
            var volume = GetComponent <Volume>();

            if (volume.profile.TryGet <ChromaticAberration>(out var ca))
            {
                chromaticAberration = ca;
            }
        }
    // Update is called once per frame
    private void Start()
    {
        TheManager = this;

        PostProcessing           = gameObject.GetComponent <PostProcessVolume>();
        DepthOfFieldLayer        = PostProcessing.profile.GetSetting <DepthOfField>();
        ChromaticAberrationLayer = PostProcessing.profile.GetSetting <ChromaticAberration>();
        ChromaticAberrationLayer.enabled.value = false;
    }
    public void Init(float _intensity)
    {
        effect = ScriptableObject.CreateInstance <ChromaticAberration>();
        effect.enabled.Override(true);
        intensity = _intensity;
        effect.intensity.Override(0);


        //StartFlash(length);
    }
示例#24
0
    private void Start()
    {
        abberation = ScriptableObject.CreateInstance <ChromaticAberration>();
        vignette   = ScriptableObject.CreateInstance <Vignette>();
        abberation.enabled.Override(true);
        vignette.enabled.Override(true);

        Post          = PostProcessManager.instance.QuickVolume(8, 100f, abberation, vignette);
        Post.isGlobal = true;
    }
示例#25
0
    // Start is called before the first frame update
    void Start()
    {
        player_cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();

        default_fov = player_cam.fieldOfView;

        ca = profile.GetSetting <ChromaticAberration>();
        ld = profile.GetSetting <LensDistortion>();
        cg = profile.GetSetting <ColorGrading>();
    }
    private void Start()
    {
        // Debug.Log("Health System Initialize");
        activeMovementComponents = gameObject.GetComponents <PlayerMovement>().ToList();
        activeWeaponComponents   = gameObject.GetComponents <PlayerWeapon>().Where(weapon => weapon != fallbackWeapon).ToList();

        chromaticAberration = postProcessing.sharedProfile.components.Where(component => component is ChromaticAberration).First() as ChromaticAberration;
        currentAbberation   = normalAbberation;
        chromaticAberration.intensity.value = currentAbberation;
    }
    // Use this for initialization
    void Start()
    {
        //use mainCamera reference to get the Chromatic Abberation and Camera Shake References setup;
        chromo = mainCam.GetComponent <ChromaticAberration>();

        shake = mainCam.GetComponent <SimpleCameraShake>();

        //get a count of the colors and store in numOfColors(another integer variable from the enum that will helps us later)
        numOfColors = System.Enum.GetValues(typeof(PlayerColor)).Length;
    }
示例#28
0
    void Start()
    {
        rb = GetComponent <Rigidbody2D>();

        coll = GetComponent <Collision>();

        gameState = GameObject.FindWithTag("GameState").GetComponent <GameState>();

        ChromeAberration_Effect = GameObject.FindWithTag("MainCamera").GetComponent <ChromaticAberration>();
    }
        internal void InitializeProfiles()
        {
            if (!SettingValues.profile.TryGetSettings(out chromaticAberrationLayer))
            {
                chromaticAberrationLayer = SettingValues.profile.AddSettings <ChromaticAberration>();
            }

            if (!SettingValues.profile.TryGetSettings(out grainLayer))
            {
                grainLayer = SettingValues.profile.AddSettings <Grain>();
            }

            if (!SettingValues.profile.TryGetSettings(out ambientOcclusionLayer))
            {
                ambientOcclusionLayer = SettingValues.profile.AddSettings <AmbientOcclusion>();
            }

            if (!SettingValues.profile.TryGetSettings(out autoExposureLayer))
            {
                autoExposureLayer = SettingValues.profile.AddSettings <AutoExposure>();
            }

            if (!SettingValues.profile.TryGetSettings(out bloomLayer))
            {
                bloomLayer = SettingValues.profile.AddSettings <Bloom>();
            }

            if (!SettingValues.profile.TryGetSettings(out colorGradingLayer))
            {
                colorGradingLayer = SettingValues.profile.AddSettings <ColorGrading>();
            }

            if (!SettingValues.profile.TryGetSettings(out depthOfFieldLayer))
            {
                depthOfFieldLayer = SettingValues.profile.AddSettings <DepthOfField>();
            }

            if (!SettingValues.profile.TryGetSettings(out screenSpaceReflectionsLayer))
            {
                screenSpaceReflectionsLayer = SettingValues.profile.AddSettings <ScreenSpaceReflections>();
            }

            if (!SettingValues.profile.TryGetSettings(out vignetteLayer))
            {
                vignetteLayer = SettingValues.profile.AddSettings <Vignette>();
            }

            if (!SettingValues.profile.TryGetSettings(out motionBlurLayer))
            {
                motionBlurLayer = SettingValues.profile.AddSettings <MotionBlur>();
                motionBlurLayer.enabled.value = false;
            }

            depthOfFieldLayer.enabled.value = false; // Make people use Depth of Field Manually
        }
示例#30
0
    void Awake()
    {
        instance = this;
        startPos = transform.position;

        PostProcessVolume volume = GetComponentInChildren <PostProcessVolume>();

        profile = volume.profile;

        chromaticAberration = profile.GetSetting <ChromaticAberration>();
    }