| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 | 
							- using System.Collections;
 
- using System.Collections.Generic;
 
- using UnityEngine;
 
- using UnityEngine.UI;
 
- public class TipBulletNumber : MonoBehaviour
 
- {
 
-     [SerializeField] Text outText;
 
-     [SerializeField] private bool autoDelete = true;
 
-     private bool disableAutoDelete = false;  // 是否禁用自动删除
 
-     private Coroutine deleteCoroutine; // 记录计时协程,方便取消
 
-     void Start()
 
-     {
 
-         if (autoDelete && !disableAutoDelete)
 
-         {
 
-             deleteCoroutine = StartCoroutine(AutoDelete());
 
-         }
 
-     }
 
-     /// <summary>
 
-     /// 3秒后自动删除对象(如果 `disableAutoDelete` 为 `false`)
 
-     /// </summary>
 
-     private IEnumerator AutoDelete()
 
-     {
 
-         yield return new WaitForSecondsRealtime(3.0f);
 
-         Destroy(gameObject);
 
-     }
 
-     /// <summary>
 
-     /// 手动删除对象
 
-     /// </summary>
 
-     public void Remove()
 
-     {
 
-         if (deleteCoroutine != null)
 
-         {
 
-             StopCoroutine(deleteCoroutine);
 
-         }
 
-         Destroy(gameObject);
 
-     }
 
-     /// <summary>
 
-     /// 设置字体颜色
 
-     /// </summary>
 
-     /// <param name="color"></param>
 
-     public void SetOutTipColor(Color color) {
 
-         outText.color = color;
 
-     }
 
-     /// <summary>
 
-     /// 设置是否禁用自动删除
 
-     /// </summary>
 
-     public void SetDisableAutoDelete(bool disable)
 
-     {
 
-         disableAutoDelete = disable;
 
-         if (disableAutoDelete && deleteCoroutine != null)
 
-         {
 
-             StopCoroutine(deleteCoroutine);
 
-         }
 
-     }
 
- }
 
-    
 
 
  |