12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using UnityEngine;
- using UnityEngine.UI;
- using System;
- using System.Collections;
- public class HudText : ObjRoot
- {
- #region 变量
- public Text Text
- {
- get
- {
- if (_Text == null)
- {
- _Text = GetComponent<Text>();
- }
- return _Text;
- }
- set { _Text = value; }
- }
- private Text _Text;
- #endregion
- private void FixedUpdate()
- {
- transform.position += new Vector3(0, 7.5f*Time.fixedDeltaTime, 0);
- Text.SetAlpha(Mathf.Lerp(Text.color.a, 0, Time.fixedDeltaTime*2));
- if (Text.color.a <= 0.05f)
- {
- ManaReso.Save(gameObject);
- }
- }
- public void Show(string str, Color color)
- {
- Text.text = str;
- Text.color = color;
- }
- }
|