Exemplo n.º 1
0
        // 开始位移
        public void BeginMove()
        {
            MoveCtrl move_ctrl = mSkillParent.SrcActor.MoveCtrl;

            move_ctrl.OnMoveDirChange = OnMoveDirChange;
            move_ctrl.OnMoveEnd       = OnMoveEnd;
        }
Exemplo n.º 2
0
        public override bool Begin(SkillAction action)
        {
            base.Begin(action);

            if (mSkillAction.ActionData.CastStageTime != 0.0f)
            {
                if (mSkillAction.ActionData.SkillInfo.ForwardSpeed != 0.0f)
                {
                    // 将位移回调设置给MoveCtrl,并设置移动速度和方向
                    MoveCtrl kMoveCtrl = mSkillAction.SkillParent.SrcActor.MoveCtrl;
                    float    moveSpeed = mSkillAction.ActionData.SkillInfo.ForwardSpeed * mSkillAction.SkillParent.SpeedScale;// 攻速影响前摇移动速度
                    mSkillAction.SkillParent.MovingSpeed        = moveSpeed;
                    mSkillAction.SkillParent.SrcActor.MoveSpeed = moveSpeed;

                    mSkillAction.BeginMove();
                    kMoveCtrl.MoveDirInAttacking(mSkillAction.SkillParent.SrcActor.ForwardDir);
                }

                mSkillAction.SkillParent.SrcActor.SetAnimationSpeed(mSkillAction.SkillParent.SpeedScale);

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        // 取消位移
        public void CancleMove()
        {
            // 施法阶段位移
            if (mSkillParent.MovingSpeed != 0.0f)
            {
                MoveCtrl move_ctrl = mSkillParent.SrcActor.MoveCtrl;

                // 先取消位移
                move_ctrl.MoveDirInAttacking(Vector3.zero);

                // 还原数据
                mSkillParent.SrcActor.MoveSpeed = mSkillParent.MovingSpeed;
                move_ctrl.OnMoveDirChange       = null;
                move_ctrl.OnMoveEnd             = null;
            }
        }
Exemplo n.º 4
0
        void RegisterAllMessage()
        {
            SubscribeNetNotify(NetMsg.MSG_ENTER_GAME, HandleServerData);
            SubscribeNetNotify(NetMsg.MSG_EASY_LOGIN, HandleServerData);
            SubscribeNetNotify(NetMsg.MSG_ACC_QUEUE, HandleServerData);
            SubscribeNetNotify(NetMsg.MSG_ACC_QUEUE_OK, HandleServerData);
            SubscribeNetNotify(NetMsg.MSG_ACC_PING, HandleServerData);
            SubscribeNetNotify(NetMsg.MSG_ACC_HOTUP, HandleServerData);
            SubscribeNetNotify(NetMsg.MSG_ACC_SYS_SETTING, HandleServerData);
            SubscribeNetNotify(NetMsg.MSG_ACC_UDP_TOKEN, HandleServerData);
            SubscribeNetNotify(NetMsg.MSG_PLAYER_REQUEST_ALL_INFO_END, HandleServerData);
            SubscribeNetNotify(NetMsg.MSG_ACC_ROLE_CHANGE_FAIL, HandleServerData);
            SubscribeNetNotify(NetMsg.MSG_PLAYER_OPEN_TIME, HandleServerData);
            SubscribeNetNotify(NetMsg.MSG_PLAYER_DAILY_RESET, HandleServerData);

            CustomDataMgr.Instance.RegisterMessages();
            DebugServer.Instance.RegisterAllMessage();
            MainmapManager.Instance.RegisterAllMessage();
            GlobalSettings.Instance.RegisterAllMessages();
            MoveCtrl.RegisterAllMessage();
            AttackCtrl.RegisterAllMessage();
            BeattackedCtrl.RegisterAllMessage();
            BuffCtrl.RegisterAllMessage();
            CooldownManager.Instance.RegisterAllMessage();
            LocalPlayerManager.Instance.RegisterAllMessage();
            GuideManager.Instance.RegisterAllMessages();
            SysConfigManager.Instance.RegisterAllMessages();
            SysPreviewManager.Instance.RegisterAllMessages();
            CullManager.Instance.RigisterAllMessage();
            InstanceManager.Instance.RegisterAllMessages();
            ChatNetEx.Instance.RegisterMessages();
            FriendsNet.Instance.RegisterMessages();
            TaskNet.Instance.RegisterMessages();
            ItemManager.Instance.RegisterAllMessage();
            TaskManager.Instance.RegisterAllMessage();
            MailNet.Instance.RegisterAllMessage();
            InstanceDropManager.Instance.RegisterAllMessages();
            TeamManager.Instance.RegisterAllMessage();
            SkillManager.Instance.RegisterAllMessage();
            xc.Dungeon.CollectionObjectManager.Instance.RegisterMessages();
            HookSettingManager.Instance.RegisterMessages();
            GuildLeagueManager.Instance.RegisterAllMessages();
            SpanServerManager.Instance.RegisterAllMessage();
            MarryManager.Instance.RegisterAllMessage();
            MiniGameManager.Instance.RegisterAllMessages();
        }
Exemplo n.º 5
0
        // 强制位置同步
        public static void ReceiveSetPos(byte[] data)
        {
            S2CNwarSetPos pack = S2CPackBase.DeserializePack <S2CNwarSetPos>(data);

            Actor actor = ActorManager.Instance.GetPlayer(pack.move.id);

            if (null == actor)
            {
                return;
            }

            MoveCtrl ctrl = actor.MoveCtrl;

            if (null != ctrl)
            {
                ctrl.ReceiveSetPos(pack);
            }
        }
Exemplo n.º 6
0
        //沿着指定方向行走 结束
        public static void ReceiveWalkEnd(byte[] data)
        {
            S2CNwarMoveStop playerWalkStop = S2CPackBase.DeserializePack <S2CNwarMoveStop>(data);

            if (playerWalkStop.stop.id.Equals(Game.GetInstance().LocalPlayerID.obj_idx))
            {
                return;
            }

            Actor actor = ActorManager.Instance.GetPlayer(playerWalkStop.stop.id);

            if (null == actor)
            {
                return;
            }

            MoveCtrl ctrl = actor.MoveCtrl;

            if (null != ctrl)
            {
                ctrl.ReceiveWalkEnd(playerWalkStop);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 开始
        /// </summary>
        public override bool Begin(SkillAction action)
        {
            base.Begin(action);

            m_DynamicStageTime = mSkillAction.ActionData.CastingStageTime;
            m_RealTargetPos    = Vector3.zero;

            // 判定是否要进入持续施法阶段
            if (mSkillAction.ActionData.SkillInfo.CastingTime <= 0.0f)
            {
                return(false);
            }

            Actor src_actor = mSkillAction.SkillParent.SrcActor;

            // 技能的隐身
            if (mSkillAction.ActionData.SkillInfo.Invisible)
            {
                if (src_actor.mVisibleCtrl.VisibleMode == EVisibleMode.Visible)
                {
                    mSkillAction.HideActor = true;
                    src_actor.mVisibleCtrl.SetActorVisible(false, true, false, VisiblePriority.SKILL);
                }
            }

            // 播放动画
            string casting_ani = mSkillAction.ActionData.CastingAnimation;

            if (casting_ani != string.Empty && casting_ani != mSkillAction.ActionData.SkillAnimation)
            {
                src_actor.Play(mSkillAction.ActionData.CastingAnimation);
            }
            src_actor.SetAnimationSpeed(mSkillAction.SkillParent.SpeedScale);

            // 施法阶段的位移
            MoveCtrl move_ctrl = src_actor.MoveCtrl;

            mSkillAction.SkillParent.MovingSpeed = mSkillAction.ActionData.SkillInfo.CastingSpeed;
            src_actor.MoveSpeed = mSkillAction.ActionData.SkillInfo.CastingSpeed;
            mSkillAction.BeginMove();

            uint target_id = mSkillAction.SkillParent.TargetID;     // 目标玩家的id

            if (target_id == 0)                                     // 无目标玩家
            {
                move_ctrl.MoveDirInAttacking(src_actor.ForwardDir); // 沿当前方向移动
                Vector3 src_pos = src_actor.Trans.position;
                m_RealTargetPos = src_pos + mSkillAction.SkillParent.AttackDir * mSkillAction.ActionData.SkillInfo.CastingSpeed * mSkillAction.ActionData.CastingStageTime;
                XNavMeshHit hit;
                if (XNavMesh.Raycast(src_pos, m_RealTargetPos, out hit, xc.Dungeon.LevelManager.GetInstance().AreaExclude))
                {
                    m_RealTargetPos = PhysicsHelp.BoundaryHitPos(src_pos, hit.position);
                }
            }
            else// 有目标玩家
            {
                Vector3 src_pos      = src_actor.Trans.position;
                Actor   target_actor = ActorManager.Instance.GetPlayer(target_id);// 获取目标玩家

                Vector3 target_pos = Vector3.zero;
                if (target_actor != null)
                {
                    target_pos = target_actor.Trans.position;
                    Vector3 vec = target_pos - src_pos;
                    float   len = vec.magnitude;

                    if (len > mSkillAction.RushTargetRange)
                    {
                        float real_len = len - mSkillAction.RushTargetRange;
                        target_pos = src_pos + vec * real_len / len;
                        XNavMeshHit hit;
                        if (XNavMesh.Raycast(src_pos, target_pos, out hit, xc.Dungeon.LevelManager.GetInstance().AreaExclude))
                        {
                            target_pos = PhysicsHelp.BoundaryHitPos(src_pos, hit.position);
                        }

                        if (mSkillAction.ActionData.SkillInfo.CastingSpeed != 0)
                        {
                            m_RealTargetPos = target_pos;
                            float calc_castingTime = real_len / mSkillAction.ActionData.SkillInfo.CastingSpeed;// 根据距离和速度计算施法阶段的时间
                            float fix_castingTime  = mSkillAction.ActionData.CastingStageTime;
                            if (calc_castingTime < fix_castingTime)
                            {
                                m_DynamicStageTime = calc_castingTime;
                            }
                        }
                    }
                    else
                    {
                        target_pos         = src_pos;
                        m_DynamicStageTime = 0;
                    }

                    move_ctrl.MoveDirInAttacking(vec);// 冲到目标点的方向
                }
                else
                {
                    target_pos = src_pos + mSkillAction.SkillParent.AttackDir * mSkillAction.ActionData.SkillInfo.CastingSpeed * mSkillAction.ActionData.CastingStageTime;
                    XNavMeshHit hit;
                    if (XNavMesh.Raycast(src_pos, target_pos, out hit, xc.Dungeon.LevelManager.GetInstance().AreaExclude))
                    {
                        target_pos      = PhysicsHelp.BoundaryHitPos(src_pos, hit.position);
                        m_RealTargetPos = target_pos;
                    }
                }

                if (src_actor.AttackCtrl.mIsSendMsg)
                {
                    C2SNwarChargeStop charge_stop = new C2SNwarChargeStop();
                    charge_stop.skill_id = mSkillAction.ActionData.SkillInfo.Id;
                    PkgNwarMove move = new PkgNwarMove();
                    move.id = src_actor.UID.obj_idx;
                    PkgNwarPos pos = new PkgNwarPos();
                    pos.px           = (int)(target_pos.x * 100);
                    pos.py           = (int)(target_pos.z * 100);
                    move.pos         = pos;
                    move.speed       = 0;
                    move.time        = 0;
                    charge_stop.move = move;

                    NetClient.GetCrossClient().SendData <C2SNwarChargeStop>(NetMsg.MSG_NWAR_CHARGE_STOP, charge_stop);
                }
            }


            return(true);
        }