12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- 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
- public override void RegistImmed()
- {
- if (RegistFlag)
- {
- return;
- }
- else
- {
- RegistFlag = true;
- }
- enabled = true;
- }
- 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, int size)
- {
- Text.text = str;
- Text.color = color;
- Text.fontSize = size;
- }
- }
|