예제 #1
0
    private void HP_OnDataChanged(float obj)
    {
        var targetRate = obj / currentData.DEFAULT_HP;

        wrapper.StartSingleton(runHPDecrease(targetRate, 0.5f));

        IEnumerator runHPDecrease(float end, float runtime = 1f)
        {
            float t        = 0;
            var   preStart = preGauge.fillAmount;

            while (t < runtime)
            {
                preGauge.fillAmount = Mathf.Lerp(preStart, end, curve.Evaluate(t / runtime));
                t += Time.unscaledDeltaTime;
                yield return(null);
            }
            preGauge.fillAmount = end;

            t = 0;
            var postStart = postGauge.fillAmount;

            while (t < runtime)
            {
                postGauge.fillAmount = Mathf.Lerp(postStart, end, curve.Evaluate(t / runtime));
                t += Time.unscaledDeltaTime * 2;
                yield return(null);
            }
            postGauge.fillAmount = end;
        }
    }
예제 #2
0
 public override void TakeDamage(HitInfo info)
 {
     base.TakeDamage(info);
     scaleAniWrapper.StartSingleton(SimpleScaleAni());
 }