void Start()
    {
        loopT = 0.0f;
        state = BlurStates.NO_BLUR;

        blurMaterial = new Material(BlurShader);
        blurMaterial.SetFloat(SHADER_PARAM_BLURX, 0.0f);
        blurMaterial.SetFloat(SHADER_PARAM_BLURY, 0.0f);
        blurMaterial.SetFloat(SHADER_PARAM_GREY_FACTOR, 0.0f);
    }
    IEnumerator AnimateShaderParams(Curves curves, float timer, BlurStates newState)
    {
        float t = 0.0f;

        while (t < timer)
        {
            yield return(null);

            UpdateBlur(curves, timer, t);
            t += Time.deltaTime;
        }

        state = newState;
    }
 void OnStartFighting()
 {
     state = BlurStates.TURNING_OFF;
     StartCoroutine(AnimateShaderParams(turnOff, TURN_OFF_TIMER, BlurStates.NO_BLUR));
 }
 void OnPrepareForMatch()
 {
     state = BlurStates.TURNING_ON;
     StartCoroutine(AnimateShaderParams(turnOn, TURN_ON_TIMER, BlurStates.LOOPING));
 }