|
@@ -83,6 +83,7 @@ public class Character : MonoBehaviour
|
|
|
[HideInInspector]
|
|
[HideInInspector]
|
|
|
public float invincibleTime; //无敌时间
|
|
public float invincibleTime; //无敌时间
|
|
|
public GameObject injuryNumText;//伤害跳字
|
|
public GameObject injuryNumText;//伤害跳字
|
|
|
|
|
+ public bool showInjuryNum; //伤害跳字开关
|
|
|
|
|
|
|
|
[Header("死亡后多久尸体消失")]
|
|
[Header("死亡后多久尸体消失")]
|
|
|
public float totalDieKeepTime = 2f;
|
|
public float totalDieKeepTime = 2f;
|
|
@@ -213,15 +214,18 @@ public class Character : MonoBehaviour
|
|
|
|
|
|
|
|
//非无敌状态扣血
|
|
//非无敌状态扣血
|
|
|
hp -= damage;
|
|
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);
|
|
uiHp.Show(hp, totalHp);
|