-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDamageText.cs
More file actions
37 lines (32 loc) · 764 Bytes
/
Copy pathDamageText.cs
File metadata and controls
37 lines (32 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using RPG.Util;
using TMPro;
using UnityEngine;
namespace RPG.UI
{
public class DamageText : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI damageText;
private ObjectPooler m_Pooler;
private string m_PoolTag;
private void Start()
{
m_Pooler = ObjectPooler.Instace;
}
public void DestroyText()
{
m_Pooler.AddToPool(m_PoolTag, gameObject);
}
public void SetPoolTag(string tag)
{
if (string.IsNullOrEmpty(m_PoolTag))
{
m_PoolTag = tag;
}
}
public void SetValue(float amount)
{
damageText.text = $"{amount:0}";
}
}
}