Ejemplo n.º 1
0
        public static bool SendSkill(CCreature m_creature, BtDatabase m_dataBase, bool bDown = false)
        {
            int targetUid = m_dataBase.GetData <int>((int)eAIParam.INT_TARGET_UID);

            if (targetUid == m_creature.GetUid())
            {
                return(false);
            }
            CCreature targetCc = CCreatureMgr.Get(targetUid);

            if (targetCc != null)
            {
                Vector2d dir = (targetCc.GetPos() - m_creature.GetPos());
                dir.Normalize();
                //if (dir == Vector2.zero)
                //{
                //    dir = m_creature.GetDir();
                //}
                int selectSkillUid = m_dataBase.GetData <int>((int)eAIParam.INT_SELECT_SKILL_INDEX);

                CSkillInfo skillInfo = m_creature.GetSkillByIndex(selectSkillUid);



                CmdFspSendSkill cmd = new CmdFspSendSkill();
                cmd.m_casterUid  = (int)m_creature.GetUid();
                cmd.m_skillIndex = selectSkillUid;

                if (skillInfo.m_skillInfo.selectTargetType == (int)eSelectTargetType.Self)
                {
                }
                else if (skillInfo.m_skillInfo.selectTargetType == (int)eSelectTargetType.Dir ||
                         skillInfo.m_skillInfo.selectTargetType == (int)eSelectTargetType.SectorDir)
                {
                    cmd.m_dir = dir;
                }
                else if (skillInfo.m_skillInfo.selectTargetType == (int)eSelectTargetType.Pos)
                {
                    cmd.m_dir    = dir;
                    cmd.m_endPos = targetCc.GetPos();
                }
                cmd.m_bDown = bDown;

                if (m_creature.m_aiType == eAIType.Player)
                {
                    m_creature.SendFspCmd(cmd);
                }
                else
                {
                    m_creature.PushCommand(cmd);
                }

                // 进入公共CD
                m_dataBase.SetData <int>((int)eAIParam.INT_SKILL_INTERVAL, GetSkillCastCd(m_creature, m_dataBase));
                // 清空当前发送的技能
                m_dataBase.SetData <int>((int)eAIParam.INT_SELECT_SKILL_INDEX, -1);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新充能技能
        /// </summary>
        private void UpdateChargeSkill(CCreature m_caster, int hurtVal)
        {
            if (m_caster == null || m_caster.m_cmdFspSendSkill == null)
            {
                return;
            }

            CSkillInfo cInfo = m_caster.GetSkillByIndex(m_caster.m_cmdFspSendSkill.m_skillIndex);

            if (cInfo == null)
            {
                return;
            }

            // 如果施法者,当前是放的蓄能大招,则不进行充能
            if (cInfo.GetCDType() == (int)eSkillCdType.Charge)
            {
                return;
            }

            foreach (KeyValuePair <int, CSkillInfo> item in m_caster.m_dicSkill)
            {
                CSkillInfo info = item.Value;
                if (info.GetCDType() == (int)eSkillCdType.Charge)
                {
                    info.AddCharge(hurtVal);
                    // 更新界面
                    m_caster.UpdateUI_Charge(info.GetSkillIndex(), info.GetChargePct());
                }
            }
        }
Ejemplo n.º 3
0
        public void Init()
        {
            CCreature player = CCreatureMgr.Get(m_curSkillCmd.m_casterUid);

            if (m_curSkillCmd.m_skillId == 0)
            {
                m_skillInfo = player.GetSkillByIndex(m_curSkillCmd.m_skillIndex).m_skillInfo;
            }
            else
            {
                // 组合技能
                SkillCsv skillCsv = CsvManager.Inst.GetCsv <SkillCsv>((int)eAllCSV.eAC_Skill);
                m_skillInfo = skillCsv.GetData(m_curSkillCmd.m_skillId);
            }

            int skillId = m_skillInfo.id;

            SkillStepCsv step = CsvManager.Inst.GetCsv <SkillStepCsv>((int)eAllCSV.eAC_SkillStep);

            m_casterData = step.GetCasterData(skillId);


            //Debug.Log("播放施法动作" + m_casterData.animaName);
            if (player.m_vCreature == null)
            {
                return;
            }

            if (m_casterData == null)
            {
                Debug.LogError("技能子表 施法配置为空:" + skillId);
                return;
            }

            m_casterObject = player.GetVObject();
            m_casterObject.StartRotate(m_curSkillCmd.m_dir.ToVector3());

            Start();
        }