private void LateUpdate() { textMesh.color = Color.Lerp(startColor, endColor, colorCurve.Evaluate(timer.GetPercent())); if (timer.IsTimeUp) { gameObject.SetActive(false); } }
/// <summary> /// 更新冷却时间同时改变滑动条和按钮状态,返回是否时间结束 /// </summary> /// <returns>是否结束</returns> protected bool UpdateCoolDownAndCheck() { if (!coolDownTimer.IsTimeUp) { buttonFullImg.fillAmount = 1 - coolDownTimer.GetPercent(); return(false); } buttonFullImg.fillAmount = 0; button.interactable = true; return(true); }
/// <summary> /// 如果勾选消融,更新延时和消融 /// </summary> private void Update() { if (!isDisslove || !delayTimer.IsTimeUp) { return; } if (dissloveTimer.IsStoped) { dissloveTimer.Start(); } if (dissloveTimer.IsTimeUp) { gameObject.SetActive(false); } else { material.SetFloat("_BurnAmount", dissolveTime.Evaluate(dissloveTimer.GetPercent())); } }
/// <summary> /// 规定时间后隐藏提示 /// </summary> private void Update() { if (!moveTimer.IsTimeUp) { rectTransform.localPosition = Vector3.LerpUnclamped(startPos, endPos, moveCurve.Evaluate(moveTimer.GetPercent())); } else { rectTransform.localPosition = endPos; } if (Timer.IsTimeUp) { Timer.Reset(duration, true); gameObject.SetActive(false); } }
private IEnumerator CrashCoroutine() { while (!timer.IsTimeUp) { mesh.material.color = Color.Lerp(normalColor, blinkColor, Mathf.PingPong(Mathf.Repeat(blinkSpeed.Evaluate(timer.GetPercent()), blinkLength), blinkLength / 2f) * (2 * blinkTimes)); yield return(null); } base.OnCollision(null); }