Exemplo n.º 1
0
 void WhiteCat.IVCPassenger.GetOn(string sitAnimName, VCPBaseSeat seat)
 {
     m_Seat = seat;
     if (null != mMotionMgr)
     {
         Action_Drive drive = mMotionMgr.GetAction <Action_Drive>();
         if (null != drive)
         {
             drive.SetSeat(sitAnimName, seat);
         }
     }
 }
Exemplo n.º 2
0
    protected void RPC_SKStartSkill(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        if (hasOwnerAuth)
        {
            return;
        }
        int        id       = stream.Read <int> ();
        int        targetid = stream.Read <int> ();
        bool       sendPara = stream.Read <bool> ();
        ISkParaNet netPara  = null;

        if (sendPara)
        {
            float[] para = stream.Read <float[]> ();
            netPara = SkillSystem.SkParaNet.FromFloatArray(para);
        }
        if (runner == null)
        {
            return;
        }
        else if (runner.SkEntityPE != null)
        {
            Pathea.MotionMgrCmpt motionMgr = runner.SkEntityPE.Entity.GetCmpt <Pathea.MotionMgrCmpt> ();
            if (null != motionMgr)
            {
                Action_HandChangeEquipHold actionHand = motionMgr.GetAction <Action_HandChangeEquipHold>();
                if (null != actionHand)
                {
                    actionHand.ChangeHoldState(true);
                }
            }

            CommonInterface com = CommonInterface.GetComByNetID(targetid);
            if (com != null)
            {
                runner.SkEntityBase.StartSkill(com.SkEntityBase, id, netPara);
            }
            else
            {
                runner.SkEntityBase.StartSkill(null, id, netPara);
            }
        }
        else if (runner.SkEntityBase != null)
        {
            CommonInterface com = CommonInterface.GetComByNetID(targetid);
            if (com != null)
            {
                runner.SkEntityBase.StartSkill(com.SkEntityBase, id, netPara);
            }
            else
            {
                runner.SkEntityBase.StartSkill(null, id, netPara);
            }
        }
    }
Exemplo n.º 3
0
        public override void DoAction(PEActionParam para = null)
        {
            if (null == trans || null == move)
            {
                return;
            }
            PEActionParamN paramN       = para as PEActionParamN;
            PeEntity       targetEntity = EntityMgr.Instance.Get(paramN.n);

            if (null != targetEntity)
            {
                m_TargetMotion = targetEntity.motionMgr;
            }
            else
            {
                return;
            }

            if (null != m_TargetMotion)
            {
                m_TargetAction = m_TargetMotion.GetAction <Action_Handed>();
            }
            else
            {
                return;
            }

            m_TargetTrans = targetEntity.peTrans;
            if (null == m_TargetTrans)
            {
                return;
            }

            if (null == m_MoveAction)
            {
                m_MoveAction = motionMgr.GetAction <Action_Move>();
            }

            m_AnimMatch = false;
            motionMgr.SetMaskState(PEActionMask.Hand, true);
            PEActionParamN param = PEActionParamN.param;

            param.n = motionMgr.Entity.Id;
            m_TargetMotion.DoActionImmediately(PEActionType.Handed, param);
            m_EndAction   = false;
            m_StartTime   = Time.time;
            m_CurTryCount = 0;
            if (PeGameMgr.IsMulti && entity == PeCreature.Instance.mainPlayer)
            {
                targetEntity.netCmpt.network.RPCServer(EPacketType.PT_NPC_RequestAiOp, (int)EReqType.Hand, entity.Id);
            }
        }
Exemplo n.º 4
0
        void UpdateMoveState()
        {
            if (PeCamera.isFreeLook || (!PeGameMgr.IsMulti && PeGameMgr.gamePause))
            {
                mMove.Move(Vector3.zero);
                return;
            }

            m_MoveDir = Vector3.zero;

            Vector3 moveDirLocal = Vector3.zero;

            moveDirLocal = PeInput.GetAxisH() * Vector3.right + PeInput.GetAxisV() * Vector3.forward;

            if (m_AutoRun && moveDirLocal == Vector3.zero && (!UIStateMgr.Instance.isTalking || GameUI.Instance.mNPCTalk.type != UINPCTalk.NormalOrSp.Normal))
            {
                moveDirLocal += Vector3.forward;
            }

            if (PeInput.Get(PeInput.LogicFunction.SwitchWalkRun) &&
                !Entity.passengerCmpt.IsOnCarrier())
            {
                m_MoveWalk = !m_MoveWalk;
            }

            float inputDirLength = moveDirLocal.magnitude;
            bool  stickWalk      = inputDirLength > 0.1f && inputDirLength < 0.9f;

            if (PeInput.Get(PeInput.LogicFunction.AutoRunOnOff))
            {
                m_AutoRun = !m_AutoRun;
            }

            if (PeInput.GetAxisV() < -0.5f || Entity.passengerCmpt.IsOnCarrier())
            {
                m_AutoRun = false;
            }

            Vector3 dodgeDir = Vector3.zero;

            if (PeInput.Get(PeInput.LogicFunction.DodgeForward))
            {
                dodgeDir += Vector3.forward;
            }
            if (PeInput.Get(PeInput.LogicFunction.DodgeRight))
            {
                dodgeDir += Vector3.right;
            }
            if (PeInput.Get(PeInput.LogicFunction.DodgeBackward))
            {
                dodgeDir += Vector3.back;
            }
            if (PeInput.Get(PeInput.LogicFunction.DodgeLeft))
            {
                dodgeDir += Vector3.left;
            }

            if (!PeInput.Get(PeInput.LogicFunction.LiberatiePerspective))
            {
                _cameraRotation = PETools.PEUtil.MainCamTransform.rotation;
            }

            //			if(PeInput.Get(PeInput.LogicFunction.SwimUp)) dodgeDir += Vector3.up;
            if (dodgeDir != Vector3.zero && (PeGameMgr.IsMulti || !PeGameMgr.gamePause))
            {
                dodgeDir = Vector3.ProjectOnPlane(_cameraRotation * dodgeDir, Vector3.up).normalized;
                mMove.Dodge(dodgeDir);
            }

            if (mMove.state == MovementState.Water)
            {
                m_MoveDir = _cameraRotation * moveDirLocal;
            }
            else
            {
                m_MoveDir = Vector3.ProjectOnPlane(_cameraRotation * moveDirLocal, Vector3.up);
            }

            if (null != m_PhyCtrl && m_PhyCtrl.spineInWater)
            {
                if (!m_PhyCtrl.headInWater)
                {
                    if (m_MoveDir.y < 0 && m_MoveDir.y > m_DiveMinY)
                    {
                        m_MoveDir.y = 0;
                    }
                    if (PeInput.Get(PeInput.LogicFunction.Jump) &&
                        !mView.IsRagdoll &&
                        !mMotionMgr.IsActionRunning(PEActionType.Dig) &&
                        !mMotionMgr.IsActionRunning(PEActionType.Gather))
                    {
                        m_PhyCtrl.ApplyImpact(Mathf.Sqrt(20f * waterJumpHeight) * Vector3.up);
                    }
                }
                if (PeInput.Get(PeInput.LogicFunction.SwimUp) &&
                    !mView.IsRagdoll &&
                    !mMotionMgr.IsActionRunning(PEActionType.Dig) &&
                    !mMotionMgr.IsActionRunning(PEActionType.Gather))
                {
                    m_PhyCtrl.ApplyMoveRequest(waterUpSpeed * Vector3.up);
                }
            }

            if (!m_MouseMoveMode)
            {
                if (mMove.autoRotate)
                {
                    if (m_MoveRequest.Count == MoveRequestCount)
                    {
                        m_MoveRequest.RemoveAt(0);
                    }
                    for (int i = 0; i < m_MoveRequest.Count; i++)
                    {
                        if (Vector3.Angle(m_MoveRequest[i], moveDirLocal) > 150f)
                        {
                            PEActionParamVBB param = PEActionParamVBB.param;
                            param.vec = m_MoveDir.normalized;
                            param.b1  = true;
                            param.b2  = false;
                            if (mMotionMgr.DoAction(PEActionType.Rotate, param))
                            {
                                m_MoveRequest.Clear();
                            }
                            break;
                        }
                    }
                    m_MoveRequest.Add(moveDirLocal);
                }
                if (mMotionMgr.IsActionRunning(PEActionType.Hand))
                {
                    if (null == m_Hand)
                    {
                        m_Hand = mMotionMgr.GetAction <Action_Hand>();
                    }
                    if (m_Hand.moveable)
                    {
                        mMove.Move(m_MoveDir.normalized, SpeedState.Walk);
                    }
                }
                else
                {
                    SpeedState state = SpeedState.Run;
                    if (PeInput.Get(PeInput.LogicFunction.Sprint))
                    {
                        state = SpeedState.Sprint;
                    }
                    else if (m_MoveWalk || stickWalk)
                    {
                        state = SpeedState.Walk;
                    }
                    mMove.Move(m_MoveDir.normalized, state);
                }
                mMove.UpdateMoveDir(m_MoveDir, moveDirLocal);
            }

            mEquip.UpdateMoveDir(m_MoveDir, moveDirLocal);

            if (PeInput.Get(PeInput.LogicFunction.Jump))
            {
                mMove.Jump();
            }
        }