Exemplo n.º 1
0
        public void ResetThreat(GameObject obj)
        {
            ThreatInfo info = FindThreadInfo(obj);

            if (null != info)
            {
                m_ThreatList.Remove(info);
            }
        }
Exemplo n.º 2
0
        public void AddThreat(GameObject obj, int value)
        {
            if (null == obj)
            {
                return;
            }

            ThreatInfo info = FindThreadInfo(obj);

            if (null == info)
            {
                info             = new ThreatInfo(obj, value);
                info.ThreatValue = Math.Max(0, info.ThreatValue);
                m_ThreatList.Add(info);
            }
            else
            {
                info.ThreatValue += value;
                info.ThreatValue  = Math.Max(0, info.ThreatValue);
            }
        }
Exemplo n.º 3
0
        public GameObject FindMaxThreatObj()
        {
            ThreatInfo maxThreat = null;

            for (int i = 0; i < m_ThreatList.Count; ++i)
            {
                if (null == maxThreat)
                {
                    maxThreat = m_ThreatList[i];
                }
                else if (maxThreat.ThreatValue < m_ThreatList[i].ThreatValue)
                {
                    maxThreat = m_ThreatList[i];
                }
            }
            if (maxThreat == null)
            {
                return(null);
            }
            return(maxThreat.ThreatObj);
        }