// Update is called once per frame
    void Update()
    {
        //if ( PlayerFactory.mMainPlayer == null )
        //    return;

        if (Mathf.Abs(GrayScale - GrayScaleWanted) < 0.001f)
        {
            GrayScale = GrayScaleWanted;
        }
        else
        {
            GrayScale += (GrayScaleWanted - GrayScale) * _Dumper;
        }

        if (Mathf.Abs(BlurThreshold - BlurThresholdWanted) < 0.001f)
        {
            BlurThreshold = BlurThresholdWanted;
        }
        else
        {
            BlurThreshold += (BlurThresholdWanted - BlurThreshold) * _Dumper;
        }

        GrayscaleEffect    gs = gameObject.GetComponent <GrayscaleEffect>();
        BloomAndLensFlares bf = gameObject.GetComponent <BloomAndLensFlares>();

        if (gs == null)
        {
            return;
        }
        if (GrayScale < 0.001f)
        {
#if UNITY_5
            gs.rampOffset = 0;
#else
            gs.grayAmount = 0;
#endif
            gs.enabled = false;
        }
        else
        {
            gs.enabled = true;
#if UNITY_5
            gs.rampOffset = GrayScale;
#else
            gs.grayAmount = GrayScale;
#endif
        }
        if (bf == null)
        {
            return;
        }
        if (bf.enabled)
        {
#if UNITY_5
            bf.bloomThreshold = BlurThreshold;
#else
            bf.bloomThreshhold = BlurThreshold;
#endif
        }
    }
示例#2
0
 // Use this for initialization
 void Start()
 {
     grayscale             = GetComponent <UnityStandardAssets.ImageEffects.Grayscale>();
     SadDayEvent.OnSadDay += StartSlowdown;
 }
示例#3
0
 // Use this for initialization
 void Start()
 {
     grayscaleScript = GetComponent <UnityStandardAssets.ImageEffects.Grayscale>();
     defaultFarPlane = GetComponent <Camera>().farClipPlane;
 }