void OnSubHp(BaseUnit source, float harmNum, DamageType damageType, HPShowType hpShowType) { string unitName, damageTypeStr, hpShowTypeStr, damageHpStr; string missStr = "闪避"; if (hpShowType == HPShowType.Miss) { Debug.Log(missStr); return; } unitName = "英雄"; damageTypeStr = damageType == DamageType.Critical ? "暴击" : "普A"; damageHpStr = harmNum.ToString(); Debug.Log(unitName + damageTypeStr + damageHpStr); }
protected void OnBeAttacked(float harmNum, bool isCritical, bool isMiss) { DamageType damageType = DamageType.Normal; HPShowType hpShowType = HPShowType.Damage; if (isCritical) { damageType = DamageType.Critical; } if (isMiss) { hpShowType = HPShowType.Miss; } if (OnSubHp != null) { OnSubHp(this, harmNum, damageType, hpShowType); } }