public void AddThreat(Avatar pAvatar, float fValue) { if (Owner == null || pAvatar == null) { return; } if (Owner == pAvatar) { return; } Threat pThreat = GetThreat(pAvatar.Id, true); if (pThreat == null) { return; } if (fValue >= 0 || pThreat.fThreat <= 0) { pThreat.fThreat += fValue; } pThreat.fThreat = Mathf.Max(0, pThreat.fThreat); pThreat.fValidTime = Constant.Threat.LeaveCombatTimer; if ((pThreat.CompareTo(m_pTarget) > 0)) { SetTarget(pThreat); } //进入战斗状态 if (m_pTarget != null) { Owner.EnterCombat(); } }
public void TickTarget() { //当前没有目标, 清空仇恨, 脱战 if (m_ThreatList == null || m_ThreatList.Count == 0) { ResetTarget(); Owner.LeaveCombat(); return; } Threat pThreat = m_ThreatList[0]; if (pThreat.CompareTo(m_pTarget) > 0) { SetTarget(pThreat); } }
public void OnTaunt(Avatar pAvatar, float fValue) { if (Owner == null) { return; } Threat pThreat = GetThreat(pAvatar.Id, true); if (pThreat == null) { return; } //受到嘲讽时,将第一名的加上去 pThreat.fThreat += fValue; pThreat.fValidTime = Constant.Threat.LeaveCombatTimer; if (!(pThreat.CompareTo(m_pTarget) > 0)) { float fMaxThreat = Mathf.Max(m_pTarget.fThreat, pThreat.fThreat); pThreat.fThreat += fMaxThreat; } SetTarget(pThreat); }