/// <summary> /// 扣HP,最少为0 /// </summary> public virtual int DeductHp(int num, bool checkDead = false) { if (IsDead) { return(0); } int temp = this.hp; this.hp = Mathf.Max(0, this.hp - num); temp -= hp; Actions.Add(DamageNotifyAction.GetAction(this.ID, temp)); if (checkDead) { CheckDead(); } return(temp); }
public IEnumerator ShowDamage(BaseAction action) { DamageNotifyAction damageAction = action as DamageNotifyAction; if (action.targetID == playerground0.ID) { playerground0.ShowDamage(damageAction.damage); } else if (action.targetID == playerground1.ID) { playerground1.ShowDamage(damageAction.damage); } else { CardFighterUI cardUI = GetCardUI(action.targetID); if (cardUI != null) { cardUI.ShowCardDamage(damageAction.damage); } } yield return(new WaitForSeconds(BattleTime.DAMAGE_SHOW_TIME)); }