瀏覽代碼

修复跳字开关无效问题

LAPTOP-OM1V99U2\永远de小亡灵 1 年之前
父節點
當前提交
b849d5382f
共有 1 個文件被更改,包括 10 次插入6 次删除
  1. 10 6
      ActionTowerDefense/Assets/Scripts/MoveCharacter.cs

+ 10 - 6
ActionTowerDefense/Assets/Scripts/MoveCharacter.cs

@@ -353,15 +353,19 @@ public class MoveCharacter : Character
         hp -= damage;
 
         //É˺¦Ìø×Ö
-        GameObject injuryNum = Instantiate(injuryNumText);
-        injuryNum.transform.position = new Vector3(transform.position.x + Random.Range(-1f, 1f), transform.position.y + 1, transform.position.z);
-        TextMeshProUGUI text = injuryNum.GetComponentInChildren<TextMeshProUGUI>();
-        text.text = damage.ToString();
-        if (gameObject.CompareTag("Player"))
+        if (showInjuryNum)
         {
-            text.color = Color.red;
+            GameObject injuryNum = Instantiate(injuryNumText);
+            injuryNum.transform.position = new Vector3(transform.position.x + Random.Range(-1f, 1f), transform.position.y + 1, transform.position.z);
+            TextMeshProUGUI text = injuryNum.GetComponentInChildren<TextMeshProUGUI>();
+            text.text = damage.ToString();
+            if (gameObject.CompareTag("Player"))
+            {
+                text.color = Color.red;
+            }
         }
 
+
         uiHp.Show(hp, totalHp);
         if (hp <= 0)
         {