示例#1
0
 public void SetActivate(bool flag)
 {
     if (flag)
     {
         controlState = TextControlState.FallOutOffToOn;
     }
     else
     {
         controlState = TextControlState.FallOutOnToOff;
     }
 }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        switch (controlState)
        {
        case TextControlState.FallOutOnToOff:
            step -= (Time.deltaTime / fallOutDelay) * Time.timeScale;

            if (step <= 0f)
            {
                step         = 0f;
                controlState = TextControlState.FallOutOffToOn;
            }

            text.color = new Color(lightCurveFallOut.Evaluate(step) * (StartColor.r - FinalColor.r) + FinalColor.r,
                                   lightCurveFallOut.Evaluate(step) * (StartColor.g - FinalColor.g) + FinalColor.g,
                                   lightCurveFallOut.Evaluate(step) * (StartColor.b - FinalColor.b) + FinalColor.b,
                                   lightCurveFallOut.Evaluate(step) * (StartColor.a - FinalColor.a) + FinalColor.a);
            break;

        case TextControlState.FallOutOffToOn:
            step += (Time.deltaTime / fallOutDelay) * Time.timeScale;

            if (step >= 1f)
            {
                step         = 1f;
                controlState = TextControlState.FallOutOnToOff;
            }

            text.color = new Color(lightCurveFallOut.Evaluate(step) * (StartColor.r - FinalColor.r) + FinalColor.r,
                                   lightCurveFallOut.Evaluate(step) * (StartColor.g - FinalColor.g) + FinalColor.g,
                                   lightCurveFallOut.Evaluate(step) * (StartColor.b - FinalColor.b) + FinalColor.b,
                                   lightCurveFallOut.Evaluate(step) * (StartColor.a - FinalColor.a) + FinalColor.a);
            break;

        default:
            break;
        }
    }