示例#1
0
        /// <summary>
        /// 触发器触发BUFF
        /// </summary>
        public void OnHitAddBuff(CCreature caster, CCreature receiver, object obj = null)
        {
            // 给自己加
            int[] selfBuffList = m_triggerData.selfBuffList;
            SkillBase.AddBuff(caster, receiver, selfBuffList, GetPos(), GetPos(), GetDir(), m_skillIndex, obj);

            // 给目标加
            int[] targetBuffList = m_triggerData.targetBuffList;
            SkillBase.AddBuff(caster, receiver, targetBuffList, GetPos(), GetPos(), GetDir(), m_skillIndex, obj);

            if (m_triggerData.bBullet)  // 如果是子弹,碰撞就调用父类的销毁
            {
                base.Destory();
            }
        }
示例#2
0
        public CSkillInfo(CCreature creature, int index, int skillId, int lv, bool subSkill = false, CSkillInfo mainSkill = null)
        {
            m_creature   = creature;
            m_skillId    = skillId;
            m_skillIndex = index;
            SkillCsv skill = CsvManager.Inst.GetCsv <SkillCsv>((int)eAllCSV.eAC_Skill);

            m_skillInfo = skill.GetData(skillId);
            m_skillLv   = lv;

            int skillDataId = skill.GetSkillDataIdByLv(skillId, lv);

            SkillDataCsv dataCsv = CsvManager.Inst.GetCsv <SkillDataCsv>((int)eAllCSV.eAC_SkillData);

            m_skillDataInfo = dataCsv.GetData(skillDataId);
            if (m_skillDataInfo == null)
            {
                return;
            }
            if (GetCDType() == (int)eSkillCdType.Time)
            {
                m_curCdTime = m_skillDataInfo.cd;
            }
            // 技能附加击中BUFF
            for (int i = 0; i < m_skillDataInfo.atkBuffList.Length; i++)
            {
                if (m_skillDataInfo.atkBuffList[i] == 0)
                {
                    continue;
                }
                BuffBase buff = SkillBase.AddBuff(m_creature, m_creature, m_skillDataInfo.atkBuffList[i], Vector2d.zero, Vector2d.zero, Vector2d.zero, index);
                if (buff != null)
                {
                    buff.m_dieDestroy = false;
                    m_buffList.Add(buff);
                }
            }
            // 技能附加受击BUFF
            for (int i = 0; i < m_skillDataInfo.hitBuffList.Length; i++)
            {
                if (m_skillDataInfo.hitBuffList[i] == 0)
                {
                    continue;
                }
                BuffBase buff = SkillBase.AddBuff(m_creature, m_creature, m_skillDataInfo.hitBuffList[i], Vector2d.zero, Vector2d.zero, Vector2d.zero, index);
                if (buff != null)
                {
                    buff.m_dieDestroy = false;
                    m_buffList.Add(buff);
                }
            }

            #region 包含子技能的部分
            m_mainSkill = mainSkill;
            if (subSkill)
            {
                return;
            }
            if (m_skillInfo.subSkill != null &&
                m_skillInfo.subSkill.Length > 0 &&
                m_skillInfo.subSkill[0] != 0)
            {
                m_bCondiSubSkill = true;
                m_nearCommon     = new CSkillInfo[m_skillInfo.subSkill.Length];
                for (int i = 0; i < m_skillInfo.subSkill.Length; i++)
                {
                    int        sSkillId = m_skillInfo.subSkill[i];
                    CSkillInfo info     = new CSkillInfo(m_creature, index, sSkillId, 1, true, this);
                    m_nearCommon[i] = info;
                }
            }
            #endregion
        }