123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- public class ManagerHint : MonoBehaviour
- {
- #region 变量
- private Text Hint;
- private float StayTimer;
- private float _StayTime;
- public static ManagerHint Ins;
- #endregion
- private void Awake()
- {
- Hint = ManagerResource.Ins.HintLabel;
- Ins = this;
- _StayTime = 1;
- }
- private void FixedUpdate()
- {
- if (Hint.color.a > 0)
- {
- StayTimer -= Time.fixedDeltaTime;
- if (StayTimer > 0)
- {
- return;
- }
- Color color = Hint.color;
- color.a = Mathf.Lerp(color.a, 0, Time.fixedDeltaTime);
- if (color.a <= 0.05f)
- {
- color.a = 0;
- }
- Hint.color = color;
- }
- }
- public void Show(string message)
- {
- Hint.text = message;
- Hint.color = new Color(Hint.color.r, Hint.color.g, Hint.color.b, 1);
- StayTimer = _StayTime;
- }
- }
|