コード例 #1
0
    IEnumerator Fade()
    {
        Group.alpha = 1;
        float lastTime,
              currentDuration = 0,
              percentProgress;

        while (currentDuration < Duration)
        {
            lastTime = Time.time;
            yield return(new WaitForSeconds(0.01f));

            currentDuration += (Time.time - lastTime);

            percentProgress = LerpHelper.CurveToZeroSlowFast(currentDuration / Duration, 5f);
            Group.alpha     = percentProgress;
        }

        Group.alpha = 0;
        Destroy(this.gameObject);
    }