コード例 #1
0
ファイル: BuffBase.cs プロジェクト: mengtest/fs
        /// <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());
                }
            }
        }
コード例 #2
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);
        }
コード例 #3
0
ファイル: CCreature_UI.cs プロジェクト: mengtest/fs
 public void UpdateUI_Skill()
 {
     if (m_dicSkill == null)
     {
         return;
     }
     // 如果是主角,坐骑主人是主角
     if (IsMaster())
     {
         JoyStickModule js = (JoyStickModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelJoyStick);
         if (js.IsShow())
         {
             for (int i = 0; i < 5; i++)
             {
                 js.SetIcon(i, -1);
             }
             foreach (KeyValuePair <int, CSkillInfo> item in m_dicSkill)
             {
                 CSkillInfo info = item.Value;
                 if (info != null)
                 {
                     js.SetIcon(item.Key, info.GetIcon());
                 }
             }
             //js.SetLock(false);
         }
     }
 }
コード例 #4
0
        public void GetSkillDis()
        {
            int        skillIndex = m_dataBase.GetData <int>((int)eAIParam.INT_SELECT_SKILL_INDEX);
            CSkillInfo skillInfo  = m_creature.GetSkillByIndex(skillIndex);

            m_skillDis = skillInfo.GetRange();


            //Debug.Log(info.Name +" m_skillDis============================" + m_skillDis);
        }
コード例 #5
0
ファイル: CCreature_Skill.cs プロジェクト: mengtest/fs
        public void AddSkill(int index, int skillId, int skillLv)
        {
            if (m_dicSkill.ContainsKey(index))
            {
                //Debug.Log("添加重复技能索引:" + index);
                RemoveSkill(index);
            }
            CSkillInfo info = new CSkillInfo(this, index, skillId, skillLv);

            m_dicSkill[index] = info;
            UpdateUI_CD(index, 0, 0);
        }
コード例 #6
0
ファイル: CCreature_Skill.cs プロジェクト: mengtest/fs
 public void RemoveSkill(int index)
 {
     if (m_dicSkill.ContainsKey(index))
     {
         CSkillInfo info = m_dicSkill[index];
         if (info != null)
         {
             info.Destoty();
             info = null;
         }
         m_dicSkill.Remove(index);
     }
 }
コード例 #7
0
ファイル: CCreature_Skill.cs プロジェクト: mengtest/fs
 public void GetCanUseSkillList(ref List <CSkillInfo> list)
 {
     list.Clear();
     for (int nIndex = 0; nIndex < 5; nIndex++)
     {
         if (m_dicSkill.ContainsKey(nIndex))
         {
             CSkillInfo skill = m_dicSkill[nIndex];
             if (skill != null && skill.IsCanUse())
             {
                 list.Add(skill);
             }
         }
     }
 }
コード例 #8
0
ファイル: CCreature_Skill.cs プロジェクト: mengtest/fs
        public void EnterSkill()
        {
            CSkillInfo sInfo = GetSkillByIndex(m_cmdFspSendSkill.m_skillIndex);

            if (sInfo == null)
            {
                return;
            }

            // 如果存在引导技能,则不再创建
            SkillBase dSkill = CSkillMgr.GetDownUpSkill(GetUid());

            if (dSkill != null)
            {
                if (sInfo.m_skillInfo.skillType == (int)eSkillType.Down_Up)
                {
                    SkillDownUp dp = dSkill as SkillDownUp;
                    dp.SetCmd(m_cmdFspSendSkill);
                }
                return;
            }

            if (!m_logicSkillEnabled)
            {
                return;
            }


            //Debug.Log("技能流程:使用技能:" + sInfo.m_skillInfo.id + " "+ sInfo.m_skillInfo.name);
            if (!sInfo.IsCanUse())
            {
                return;
            }

            //Debug.Log("CD 正常进入技能:" + m_cmdFspSendSkill.m_skillIndex + " " + sInfo.m_skillDataInfo.name);

            SkillCsvData m_skillInfo = sInfo.m_skillInfo;

            StartSkill(m_skillInfo);
            sInfo.GetMainSkill().OnUseSkill();
        }
コード例 #9
0
ファイル: CCreature_Skill.cs プロジェクト: mengtest/fs
        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
        }
コード例 #10
0
ファイル: JoyStickModule.cs プロジェクト: mengtest/fs
        /// <summary>
        /// 摇杆的场景指示器也只能主角自己有,并且是操作完成才发送指令
        /// </summary>
        private void OnSkillEvent(int index, eJoyStickEvent jsEvent, Vector2 m_delta, bool bCancel)
        {
            m_curSkillIndex    = index;
            m_curSkillJoyStick = jsEvent;
            CCreature master = CCreatureMgr.GetMaster();

            CSkillInfo sInfo = m_master.GetSkillByIndex(index);

            //if (sInfo == null || !sInfo.IsCanUse())
            //{
            //    Debug.Log(index + " 不可用" + jsEvent);
            //    return;
            //}


            if (jsEvent == eJoyStickEvent.Drag)
            {
                m_curSkillDir = new Vector3(m_delta.x, 0, m_delta.y);
                m_curSkillDir.Normalize();
            }

            if (jsEvent == eJoyStickEvent.Down)
            {
                m_bSkillCancel = false;

                skillInfo = sInfo.m_skillInfo;


                m_ui.m_cancelBtn.SetActiveNew(true);
                m_ui.SetColor(index, SKLL_BLUE);


                m_skillChose.gameObject.SetActiveNew(true);
                m_skillCenter.gameObject.SetActiveNew(true);
                m_skillDistance.gameObject.SetActiveNew(true);
                m_skillSectorDir.gameObject.SetActiveNew(false);
                m_skillDir.gameObject.SetActiveNew(false);
                m_skillPos.gameObject.SetActiveNew(false);

                m_skillDistance.localScale = new Vector3(skillInfo.distance, 0.01f, skillInfo.distance) * 2;
            }

            // 自己
            if (skillInfo.selectTargetType == (int)eSelectTargetType.Self)
            {
                m_curSkillDir = master.GetDir().ToVector3();
            }
            // 扇形方向
            else if (skillInfo.selectTargetType == (int)eSelectTargetType.SectorDir)
            {
                if (jsEvent == eJoyStickEvent.Down)
                {
                    m_curSkillDir = master.GetDir().ToVector3();
                    m_skillSectorDir.gameObject.SetActiveNew(true);
                    m_skillSectorDir.localScale = new Vector3(skillInfo.distance, 0.01f, skillInfo.distance);
                }
                else if (jsEvent == eJoyStickEvent.Drag)
                {
                }
                m_skillCenter.rotation = Quaternion.LookRotation(m_curSkillDir);  // 只用控制中心点的方向
            }
            // 直线方向
            else if (skillInfo.selectTargetType == (int)eSelectTargetType.Dir)
            {
                if (jsEvent == eJoyStickEvent.Down)
                {
                    int tUid = master.GetTarget(skillInfo.distance);
                    if (tUid == 0)
                    {
                        m_curSkillDir = master.GetDir().ToVector3();
                    }
                    else
                    {
                        CCreature cc = CCreatureMgr.Get(tUid);
                        if (cc != null)
                        {
                            m_curSkillDir = (cc.GetPos() - master.GetPos()).ToVector3().normalized;
                        }
                    }
                    m_skillDir.gameObject.SetActiveNew(true);
                    m_skillDir.localScale = new Vector3(skillInfo.distance, 0.01f, skillInfo.distance);
                }
                else if (jsEvent == eJoyStickEvent.Drag)
                {
                }
                m_skillCenter.rotation = Quaternion.LookRotation(m_curSkillDir);  // 只用控制中心点的方向
            }
            // 位置
            else if (skillInfo.selectTargetType == (int)eSelectTargetType.Pos)
            {
                if (jsEvent == eJoyStickEvent.Down)
                {
                    int tUid = master.GetTarget(skillInfo.distance);
                    if (tUid == 0)
                    {
                        m_curSkilPos = m_master.GetPos().ToVector3();
                    }
                    else
                    {
                        CCreature cc = CCreatureMgr.Get(tUid);
                        if (cc != null)
                        {
                            m_curSkilPos = cc.GetPos().ToVector3();
                        }
                    }
                    m_skillPos.gameObject.SetActiveNew(true);
                    m_skillPos.position   = m_curSkilPos;
                    m_skillPos.localScale = new Vector3(skillInfo.length, 0.001f, skillInfo.length);
                }
                else if (jsEvent == eJoyStickEvent.Drag)
                {
                    Vector3 atkOffset = m_curSkillDir * m_delta.magnitude * skillInfo.distance;
                    m_curSkilPos        = m_master.m_vCreature.GetEnt().GetPos() + atkOffset;
                    m_skillPos.position = m_curSkilPos;
                }
            }

            if (jsEvent == eJoyStickEvent.Up)
            {
                // 发送技能
                if (!m_bSkillCancel)
                {
                    m_bSkillCancel = true;
                    //Debug.Log("发送技能:" + skillInfo.id  + "dir:" + m_curSkillDir + " pos:" + m_curSkilPos);
                    CmdFspSendSkill cmd = new CmdFspSendSkill();
                    cmd.m_casterUid  = (int)m_master.GetUid();
                    cmd.m_skillIndex = m_curSkillIndex;
                    cmd.m_dir        = (new Vector2(m_curSkillDir.x, m_curSkillDir.z)).ToVector2d();
                    cmd.m_endPos     = (new Vector2(m_curSkilPos.x, m_curSkilPos.z)).ToVector2d();
                    master.SendFspCmd(cmd);

                    OnSkillSpeak(index);
                }
                // 还原指示器
                CancelSkill();

                m_skillChose.gameObject.SetActiveNew(false);
            }
        }