Пример #1
0
        public override void Destory()
        {
            m_destroy = true;

            CFrameTimeMgr.Inst.RemoveEvent(m_skillLifeEventHid);
            //Debug.Log("destory skill:" + m_skillInfo.name);
            SetLogicEnable(true);

            CCreature cc = GetCaster();

            if (cc != null)
            {
                cc.PushCommand(CmdFspStopMove.Inst);
                // 如果在释放技能时,操作了移动,技能释放结束修改方向
                //if (cc.m_cmdFspMove != null)
                //    cc.SetDir(GetCaster().m_cmdFspMove.m_dir);
            }

            // 销毁表现层
            if (m_vSkill != null)
            {
                m_vSkill.Destory();
                m_vSkill = null;
            }
        }
Пример #2
0
        /// <summary>
        /// m_logicSkillEnabled用于控制技能的保护状态
        /// 也用于BUFF去设置技能是否可用
        /// </summary>
        public void SetLogicEnable(bool bTrue)
        {
            CCreature cc = GetCaster();

            if (cc == null)
            {
                return;
            }
            cc.m_logicSkillEnabled = bTrue;

            // 不能移动的技能,才需要设置逻辑是否移动,常规的MOBA技能释放
            // 比如机枪,就可以边走边释放,就不设置逻辑是否移动
            if (m_skillInfo.bRota)
            {
                cc.m_logicSkillRotationEnabled = !bTrue;
            }
            if (!m_skillInfo.bMove)
            {
                cc.PushCommand(CmdFspStopMove.Inst);
                cc.SetLogicMoveEnabled(bTrue);
                // 释放技能不能移动时
                VBase v = cc.m_vCreature;
                if (v != null)
                {
                    v.SetMove(bTrue);
                }
            }
            // 重置遥感,一般在按下移动,并技能释放完之后,还需继续移动
            if (bTrue)
            {
                cc.UpdateUI_ResetJoyStick(true);
            }
        }
Пример #3
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);
        }
Пример #4
0
        public static void SendSkill(CCreature m_creature, BtDatabase m_dataBase)
        {
            int             selectSkillUid = m_dataBase.GetData <int>((int)eAIParam.INT_SELECT_SKILL_INDEX);
            CmdFspSendSkill cmd            = new CmdFspSendSkill();

            cmd.m_casterUid  = (int)m_creature.GetUid();
            cmd.m_skillIndex = selectSkillUid;
            cmd.m_bDown      = false;
            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, 0);
        }
Пример #5
0
 public void SetStopMove(CCreature rec)
 {
     if (rec == null)
     {
         return;
     }
     rec.SetLogicMoveEnabled(false);
     rec.PushCommand(CmdFspStopMove.Inst);
     //CCreature ride = rec.GetRide();
     //if (ride != null)
     //{
     //    ride.m_logicMoveEnabled = false;
     //    ride.PushCommand(CmdFspStopMove.Inst);
     //    ride.StopAutoMove();
     //}
 }
Пример #6
0
        /// <summary>
        /// 消息内容转指令对象
        /// </summary>
        private void HandleServerCmd(FspVKey cmd)
        {
            CmdFspEnum type = (CmdFspEnum)cmd.vkey;
            uint       uid  = cmd.playerId;

            if (uid == 0)
            {
                return;
            }
            CCreature   player   = CCreatureMgr.Get(uid);
            IFspCmdType logicCmd = null;

            switch (type)
            {
            case CmdFspEnum.eFspStopMove:
                //Debug.Log(uid + " 停止移动");
                logicCmd = new CmdFspStopMove();
                break;

            case CmdFspEnum.eFspMove:
                //Debug.Log(uid + " 客户端调用移动命令 " + cmd.args[0] + " " + cmd.args[1]);
                Vector2d v = new Vector2d(cmd.args[0] * 0.01f, cmd.args[1] * 0.01f);
                logicCmd = new CmdFspMove(ref v);
                break;

            case CmdFspEnum.eFspAutoMove:
                Vector2d v1 = new Vector2d(cmd.args[0] * 0.01f, cmd.args[1] * 0.01f);
                logicCmd = new CmdFspAutoMove(ref v1);
                break;

            case CmdFspEnum.eFspSendSkill:
                //Debug.Log(uid + " 客户端调用技能 " + cmd.args[0] + " " + cmd.args[1]);

                CmdFspSendSkill skill = new CmdFspSendSkill();
                skill.m_casterUid  = cmd.args[0];
                skill.m_skillIndex = cmd.args[1];
                skill.m_targetId   = cmd.args[2];
                Vector2d dir    = new Vector2d(cmd.args[3] * 0.01f, cmd.args[4] * 0.01f);
                Vector2d endPos = new Vector2d(cmd.args[5] * 0.01f, cmd.args[6] * 0.01f);
                skill.m_dir    = dir;
                skill.m_endPos = endPos;
                logicCmd       = skill;
                break;
            }
            player.PushCommand(logicCmd);
        }