123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- using System.Collections.Generic;
- public class HudTextPlus : MonoBehaviour
- {
- #region 变量
- public Text Text
- {
- get
- {
- if (Text_ == null)
- {
- Text_ = GetComponent<Text>();
- }
- return Text_;
- }
- set { Text_ = value; }
- }
- public Outline Outline
- {
- get
- {
- if (Outline_ == null)
- {
- Outline_ = GetComponent<Outline>();
- }
- return Outline_;
- }
- set { Outline_ = value; }
- }
- public Text Text_;
- public Outline Outline_;
- public float Speed;
- public Vector3 Direction;
- #endregion
- private void FixedUpdate()
- {
- transform.position += new Vector3(0, Speed*Time.fixedDeltaTime, 0);
- if (Text.color.a <= 0.05f)
- {
- ManaReso.Save(gameObject);
- }
- }
- public void SetOutline(Color color)
- {
- Outline.effectColor = color;
- }
- public void SetOutline(Color color, Vector2 size)
- {
- Outline.effectColor = color;
- Outline.effectDistance = size;
- }
- public void SetDirection(Vector3 direction)
- {
- Direction = direction;
- }
- public void Show(string str, int size, float time, float speed)
- {
- Text.text = str;
- Text.fontSize = size;
- Speed = speed;
- Tween tween = Text.CreateTweenGra(0, time, false, false, Curve.EaseOutQuad);
- tween.StartForward();
- }
- public void Show(string str, int size, float time, float speed, Color originColor)
- {
- Text.text = str;
- Text.fontSize = size;
- Speed = speed;
- Text.color = originColor;
- Tween tween = Text.CreateTweenGra(0, time, false, false, Curve.EaseOutQuad);
- tween.StartForward();
- }
- public void Show(string str, int size, float time, float speed, Color originColor, Color destColor)
- {
- Text.text = str;
- Text.fontSize = size;
- Speed = speed;
- Text.color = originColor;
- Tween tween = Text.CreateTweenGra(destColor, time, false, false, Curve.EaseOutQuad);
- tween.StartForward();
- }
- }
|