Beispiel #1
0
        public void StartCD(int nSkillID, float fCDtime)
        {
            if (Owner == null)
            {
                return;
            }

            DRCDdefine pCDData = GameEntry.DataTable.GetDataTable <DRCDdefine>().GetDataRow(nSkillID);

            if (pCDData != null)
            {
                StartCD(nSkillID);
                return;
            }

            sCDInfo info = new sCDInfo();

            info.fCurTime   = fCDtime;
            info.fTotalTime = fCDtime;

            if (m_CDDict.ContainsKey(nSkillID))
            {
                float fTime = m_CDDict[nSkillID].fCurTime;
                fTime = Mathf.Max(fTime, info.fCurTime);
                m_CDDict[nSkillID].UpdateCD(fTime);
            }
            else
            {
                AddCDToDict(nSkillID, info);
            }
        }
Beispiel #2
0
        private bool StartCountCD(int nGroupID, DRCDdefine pCDData)
        {
            if (Owner == null)
            {
                return(false);
            }
            //充能计数
            int nCDCount     = 0;
            int nConfigCount = pCDData.CDCount;

            if (nConfigCount > 0)
            {
                if (m_CDCountDict.ContainsKey(nGroupID))
                {
                    nCDCount = m_CDCountDict[nGroupID];
                    m_CDCountDict[nGroupID] = (--nCDCount);
                }
                else
                {
                    nCDCount = nConfigCount;
                    m_CDCountDict.Add(nGroupID, --nCDCount);
                }

                if (!m_CDDict.ContainsKey(nGroupID))
                {
                    AddCDToDict(nGroupID, pCDData.CDTime);
                }
                return(true);
            }
            return(false);
        }
Beispiel #3
0
        /// <summary>
        /// 返回为true则正在CD中
        /// </summary>
        public bool CheckCD(int nCDindex)
        {
            if (Owner == null)
            {
                return(false);
            }

            DRCDdefine pCDData = GameEntry.DataTable.GetDataTable <DRCDdefine>().GetDataRow(nCDindex);

            if (pCDData == null)
            {
                return(false);
            }

            if (m_CDCommonDict.ContainsKey(pCDData.CDCommon))
            {
                return(true);
            }

            if (m_CDCountDict.ContainsKey(nCDindex) && m_CDCountDict[nCDindex] > 0)
            {
                return(false);
            }

            if (m_CDDict.ContainsKey(nCDindex))
            {
                return(true);
            }

            return(false);
        }
Beispiel #4
0
        public void StartCD(int nGroupID)
        {
            if (Owner == null)
            {
                return;
            }
            DRCDdefine pCDData = GameEntry.DataTable.GetDataTable <DRCDdefine>().GetDataRow(nGroupID);

            if (pCDData == null)
            {
                return;
            }

            if (StartCountCD(nGroupID, pCDData))
            {
                return;
            }
            else
            {
                if (m_CDDict.ContainsKey(nGroupID))
                {
                    float fTime = m_CDDict[nGroupID].fCurTime;
                    fTime = Mathf.Max(fTime, pCDData.CDTime);
                    m_CDDict[nGroupID].UpdateCD(fTime);
                }
                else
                {
                    AddCDToDict(nGroupID, pCDData.CDTime);
                }
            }

            StartCommonCD(pCDData.CDCommon);
        }
Beispiel #5
0
 public void StopAllCD()
 {
     m_CDDict.Clear();
     foreach (KeyValuePair <int, int> item in m_CDCountDict)
     {
         DRCDdefine pCDData = GameEntry.DataTable.GetDataTable <DRCDdefine>().GetDataRow(item.Key);
         if (pCDData == null)
         {
             return;
         }
         m_CDCountDict[item.Key] = pCDData.CDCount;
     }
 }
Beispiel #6
0
        public void StopCD(int nCDindex)
        {
            if (Owner == null)
            {
                return;
            }

            m_CDDict.Remove(nCDindex);

            DRCDdefine pCDData = GameEntry.DataTable.GetDataTable <DRCDdefine>().GetDataRow(nCDindex);

            if (pCDData == null)
            {
                return;
            }
            m_CDCountDict[nCDindex] = pCDData.CDCount;
        }
Beispiel #7
0
        private bool RecoverCDCount(int nCDindex, float fTime)
        {
            DRCDdefine pCDData = GameEntry.DataTable.GetDataTable <DRCDdefine>().GetDataRow(nCDindex);

            if (pCDData == null)
            {
                return(false);
            }

            //当且仅当充能技能在CD中且CD会被减为0以下时回复充能
            if (m_CDCountDict.ContainsKey(nCDindex) && fTime < 0)
            {
                int nCDCount = m_CDCountDict[nCDindex] + 1;
                nCDCount = Mathf.Min(pCDData.CDCount, nCDCount);
                m_CDCountDict[nCDindex] = nCDCount;
                return(true);
            }
            return(false);
        }
Beispiel #8
0
        public void StartCommonCD(int nCommonCD)
        {
            if (Owner == null)
            {
                return;
            }
            DRCDdefine pCommonCDData = GameEntry.DataTable.GetDataTable <DRCDdefine>().GetDataRow(nCommonCD);

            if (pCommonCDData == null)
            {
                return;
            }

            sCDInfo info = new sCDInfo();

            info.fCurTime   = pCommonCDData.CDTime;
            info.fTotalTime = pCommonCDData.CDTime;
            m_CDCommonDict[pCommonCDData.Id] = info;
        }