public void SetPercent(float percent, bool anim = true) { if (percent < 0f) { percent = 0f; } if (percent > 1f) { percent = 1f; } float nowPercent = this.nowPercent; this.nowPercent = percent; oldPercent = percent; if (anim) { oldPercent = nowPercent; animPhase = ANIM_PHASE.WAIT; animTime = 3f; } else { animPhase = ANIM_PHASE.NONE; } }
private void LateUpdate() { if (animPhase == ANIM_PHASE.WAIT) { animTime -= Time.get_deltaTime(); if (animTime <= 0f) { animPhase = ANIM_PHASE.MOVE; animTime = 0.5f; } } else if (animPhase == ANIM_PHASE.MOVE) { animTime -= Time.get_deltaTime(); if (animTime <= 0f) { animPhase = ANIM_PHASE.NONE; animTime = 0f; } } UpdateGauge(); }