|
@@ -275,6 +275,58 @@ public class Character : MonoBehaviour
|
|
|
//造成伤害附加其他效果
|
|
//造成伤害附加其他效果
|
|
|
public virtual void BeHit(AttackController.AttackMethod attackMethod, Character attackFrom, int damage = -1)
|
|
public virtual void BeHit(AttackController.AttackMethod attackMethod, Character attackFrom, int damage = -1)
|
|
|
{
|
|
{
|
|
|
|
|
+ if (invincibleTime > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ AttackInfo attackInfo = attackMethod.attackInfo;
|
|
|
|
|
+
|
|
|
|
|
+ int damageData;
|
|
|
|
|
+ if (damage == -1)
|
|
|
|
|
+ {
|
|
|
|
|
+ damageData = attackInfo.damage;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ damageData = damage;
|
|
|
|
|
+ }
|
|
|
|
|
+ hp -= damageData;
|
|
|
|
|
+
|
|
|
|
|
+ //伤害跳字
|
|
|
|
|
+ if (showInjuryNum)
|
|
|
|
|
+ {
|
|
|
|
|
+ GameObject injuryNum;
|
|
|
|
|
+ //是起手式
|
|
|
|
|
+ if ((attackFrom.CompareTag("Demonic") || attackFrom.CompareTag("Player")) && attackInfo.attackMethod_Type == AttackMethod_Type.Attack_Summon)
|
|
|
|
|
+ {
|
|
|
|
|
+ injuryNum = PoolManager.Instantiate(injuryNumTextSummon);
|
|
|
|
|
+ injuryNum.transform.position = new Vector3(
|
|
|
|
|
+ transform.position.x + injuryNumPos_summon.x + Random.Range(-injuryNumRandom_summon.x / 2f, injuryNumRandom_summon.x / 2f),
|
|
|
|
|
+ transform.position.y + injuryNumPos_summon.y + Random.Range(-injuryNumRandom_summon.y / 2f, injuryNumRandom_summon.y / 2f),
|
|
|
|
|
+ transform.position.z);
|
|
|
|
|
+ }
|
|
|
|
|
+ //不是起手式
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ injuryNum = PoolManager.Instantiate(injuryNumText);
|
|
|
|
|
+ injuryNum.transform.position = new Vector3(
|
|
|
|
|
+ transform.position.x + injuryNumPos_march.x + Random.Range(-injuryNumRandom_march.x / 2f, injuryNumRandom_march.x / 2f),
|
|
|
|
|
+ transform.position.y + injuryNumPos_march.y + Random.Range(-injuryNumRandom_march.y / 2f, injuryNumRandom_march.y / 2f),
|
|
|
|
|
+ transform.position.z);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ TextMeshProUGUI text = injuryNum.GetComponentInChildren<TextMeshProUGUI>();
|
|
|
|
|
+ text.text = damageData.ToString();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (uiHp)
|
|
|
|
|
+ {
|
|
|
|
|
+ uiHp.Show(hp, totalHp);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (hp <= 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ ChangeState(CharacterState.Die);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public virtual Vector3 GetMoveDir()
|
|
public virtual Vector3 GetMoveDir()
|