Esempio n. 1
0
    /// <summary>
    /// 技能是否正在CD中, 考虑自身CD和公共CD
    /// </summary>
    /// <param name="skillID"></param>
    /// <returns></returns>
    public bool IsOnCD(int skillID)
    {
        Debug.Assert(m_SkillIDToSkill.ContainsKey(skillID));
        if (!m_SkillIDToSkill.ContainsKey(skillID))
        {
            return(false);
        }

        PlayerSkillVO skill = m_SkillIDToSkill[skillID];

        // 如果是武器技能, 则不考虑公共CD
        return(skill.GetRemainingCD() > 0 ||
               Time.time < m_SkillTypeToGlobalCDEndTime[GetSkillType(skillID)]);
    }
Esempio n. 2
0
    public float GetRemainingCD(int skillID)
    {
        Debug.Assert(m_SkillIDToSkill.ContainsKey(skillID));
        if (!m_SkillIDToSkill.ContainsKey(skillID))
        {
            return(0f);
        }

        PlayerSkillVO skill             = m_SkillIDToSkill[skillID];
        float         skillCD           = skill.GetRemainingCD();
        float         remainingGlobalCD = Mathf.Clamp(m_SkillTypeToGlobalCDEndTime[(SkillType)skill.GetSkillGrow().SkillType] - Time.time, 0, 99999f);

        if (remainingGlobalCD > skillCD)
        {
            skillCD = remainingGlobalCD;
        }

        return(skillCD);
    }