public void SetAttackerInfo(int attackId, bool isKiller, bool isNormalAttack, bool isCritical, int hpDamage, int npDamage)
        {
            if (isKiller)
            {
                KillerId = attackId;
            }
            long curTime = TimeUtility.GetLocalMilliseconds();

            LastAttackedTime = curTime;
            AttackerInfo info;

            if (!AttackerInfos.TryGetValue(attackId, out info))
            {
                AttackerInfos.Add(attackId, new AttackerInfo {
                    m_AttackTime = curTime, m_HpDamage = hpDamage, m_NpDamage = npDamage
                });
            }
            else
            {
                info.m_AttackTime       = curTime;
                info.m_HpDamage        += hpDamage;
                info.m_NpDamage        += npDamage;
                AttackerInfos[attackId] = info;
            }
            EntityManager.FireDamageEvent(GetId(), attackId, isNormalAttack, isCritical, hpDamage, npDamage);
        }
 public void ResetAttackerInfo()
 {
     KillerId = 0;
     AttackerInfos.Clear();
     m_LastAttackedTime = 0;
     m_LastAttackTime   = 0;
     m_WaitDeleteAttackers.Clear();
     m_LastRetireTime = 0;
 }
        public void RetireAttackerInfos(long lifetime)
        {
            long curTime = TimeUtility.GetLocalMilliseconds();

            if (m_LastRetireTime + lifetime < curTime)
            {
                m_LastRetireTime = curTime;

                m_WaitDeleteAttackers.Clear();
                foreach (var pair in AttackerInfos)
                {
                    AttackerInfo info = pair.Value;
                    if (info.m_AttackTime + lifetime < curTime || m_SceneContext.GetEntityById(pair.Key) == null)
                    {
                        m_WaitDeleteAttackers.Add(pair.Key);
                    }
                }
                for (int i = 0; i < m_WaitDeleteAttackers.Count; ++i)
                {
                    AttackerInfos.Remove(m_WaitDeleteAttackers[i]);
                }
                m_WaitDeleteAttackers.Clear();
            }
        }