Ejemplo n.º 1
0
    void OnOkBtn()
    {
        //		if (DoSleep)//mDoSleep != null
        //        {
        //			mDoSleep((int)(((int)11 * mSleepSlider.scrollValue) + 1));
        //			ShowSleepWnd(false);
        //		}
        //		else
        //			Hide();
        if (m_PeSleep == null || mEntity == null)
        {
            return;
        }

        if (!m_PeSleep.CanOperateMask(Pathea.Operate.EOperationMask.Sleep))
        {
            return;
        }

        Pathea.MotionMgrCmpt mmc = mEntity.GetCmpt <Pathea.MotionMgrCmpt>();

        if (null != mmc && (mmc.IsActionRunning(Pathea.PEActionType.Sleep) || !mmc.CanDoAction(Pathea.PEActionType.Sleep)))
        {
            return;
        }

        SleepController.StartSleep(m_PeSleep, mEntity, GetCurSleepTime());
        ShowSleepWnd(false);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 坐骑模型被重刷,ride点被重建,乘骑恢复
    /// </summary>
    /// <param name="playerEntity"></param>
    /// <returns></returns>
    public bool RecoverExecRide(PeEntity playerEntity)
    {
        if (_monsterEntity && playerEntity && _rides)
        {
            Pathea.MotionMgrCmpt mmc     = playerEntity.motionMgr;
            OperateCmpt          operate = playerEntity.operateCmpt;
            if (null != mmc && null != operate)
            {
                PERide ride = _rides.GetUseable();
                if (ride && ride.CanOperateMask(EOperationMask.Ride))
                {
                    if (mmc.IsActionRunning(Pathea.PEActionType.Ride))
                    {
                        mmc.EndImmediately(Pathea.PEActionType.Ride);
                    }

                    return(ride.StartOperate(operate, EOperationMask.Ride));
                }
                else
                {
                    Debug.Log("Try recover ride failed!! ride is null!");
                }
            }
            else
            {
                Debug.LogFormat("Try recover ride failed!! mmc is null:{0} ; operate is null:{1} ", null == mmc, null == operate);
            }
        }
        else
        {
            Debug.LogFormat("Try recover ride failed!! _monsterEntity is null:{0} ; playerEntity is null:{1} ; _rides is null:{2} ", null == _monsterEntity, null == playerEntity, null == _rides);
        }
        return(false);
    }
Ejemplo n.º 3
0
 /// <summary>
 /// 执行下这只怪物
 /// </summary>
 /// <param name="playerEntity">玩家Entity</param>
 public bool ExecUnRide(PeEntity playerEntity)
 {
     if (_monsterEntity && playerEntity && _rides)
     {
         Pathea.MotionMgrCmpt mmc     = playerEntity.motionMgr;
         OperateCmpt          operate = playerEntity.operateCmpt;
         if (null != mmc && mmc.IsActionRunning(Pathea.PEActionType.Ride) && null != operate)
         {
             PERide ride = _rides.GetRideByOperater(operate);
             if (ride)
             {
                 return(ride.StopOperate(operate, EOperationMask.Ride));
             }
             else
             {
                 Debug.Log("Try exec unRide failed!! ride is null!");
             }
         }
         else
         {
             Debug.LogFormat("Try exec unRide failed!! mmc is null:{0} ; operate is null:{1} ", null == mmc, null == operate);
         }
     }
     else
     {
         Debug.LogFormat("Try exec ride failed!! _monsterEntity is null:{0} ; playerEntity is null:{1} ; _rides is null:{2} ", null == _monsterEntity, null == playerEntity, null == _rides);
     }
     return(false);
 }
Ejemplo n.º 4
0
    protected bool Operatable()
    {
        if (operation == null)
        {
            return(false);
        }

        if (!operation.CanOperateMask(m_Mask))
        {
            return(false);
        }

        Pathea.OperateCmpt operateCmpt = Pathea.MainPlayer.Instance.entity.operateCmpt;
        if (null != operateCmpt && operateCmpt.HasOperate)
        {
            return(false);
        }

        Pathea.MotionMgrCmpt mmc = Pathea.MainPlayer.Instance.entity.motionMgr;

        if (null != mmc && (mmc.IsActionRunning(m_ActionType) || !mmc.CanDoAction(m_ActionType)))
        {
            return(false);
        }

        return(true);
    }
    protected override void CheckOperate()
    {
        base.CheckOperate();

        if (PeInput.Get(PeInput.LogicFunction.InteractWithItem) && CanCmd())
        {
            if (EntityMonsterBeacon.IsRunning())
            {
                PeTipMsg.Register(PELocalization.GetString(8000596), PeTipMsg.EMsgLevel.Warning);
                return;
            }

            if (!Operatable())
            {
                return;
            }

            Pathea.OperateCmpt operateCmpt = Pathea.MainPlayer.Instance.entity.operateCmpt;
            if (null != operateCmpt && operateCmpt.HasOperate)
            {
                return;
            }

            Pathea.MotionMgrCmpt mmc = Pathea.MainPlayer.Instance.entity.motionMgr;

            if (null != mmc && (mmc.IsActionRunning(Pathea.PEActionType.Sleep) || !mmc.CanDoAction(Pathea.PEActionType.Sleep)))
            {
                return;
            }

            GameUI.Instance.mItemOp.ShowSleepWnd(true, this, bedView.peSleep, Pathea.MainPlayer.Instance.entity);
            // GameUI.Instance.mItemOp.SleepImmediately(bedView.peSleep, Pathea.MainPlayer.Instance.entity);
        }
    }
Ejemplo n.º 6
0
 bool CheckExecution(ActionRelationData data)
 {
     for (int i = 0; i < data.m_EndAction.Count; ++i)
     {
         if (m_MotionMgr.IsActionRunning(data.m_EndAction[i]))
         {
             return(false);
         }
     }
     return(true);
 }
    protected override void InitCmd(CmdList cmdList)
    {
        cmdList.Add("Turn", Turn90Degree);
        cmdList.Add("Get", OnGetBtn);

        //if (!GameConfig.IsMultiMode)
        {
            if (bedView.peSleep.CanOperateMask(Pathea.Operate.EOperationMask.Sleep))
            {
                cmdList.Add("Sleep", () =>
                {
                    if (EntityMonsterBeacon.IsRunning())
                    {
                        PeTipMsg.Register(PELocalization.GetString(8000596), PeTipMsg.EMsgLevel.Warning);
                        return;
                    }
                    if (!bedView.peSleep.CanOperateMask(Pathea.Operate.EOperationMask.Sleep))
                    {
                        return;
                    }

                    Pathea.OperateCmpt operateCmpt = Pathea.MainPlayer.Instance.entity.operateCmpt;
                    if (null != operateCmpt && operateCmpt.HasOperate)
                    {
                        return;
                    }

                    Pathea.MotionMgrCmpt mmc = Pathea.MainPlayer.Instance.entity.GetCmpt <Pathea.MotionMgrCmpt>();

                    if (null != mmc && (mmc.IsActionRunning(Pathea.PEActionType.Sleep) || !mmc.CanDoAction(Pathea.PEActionType.Sleep)))
                    {
                        return;
                    }

                    //if (GameConfig.IsMultiMode)
                    //     GameUI.Instance.mItemOp.SleepImmediately(bedView.peSleep, Pathea.MainPlayer.Instance.entity);
                    //else
                    GameUI.Instance.mItemOp.ShowSleepWnd(true, this, bedView.peSleep, Pathea.MainPlayer.Instance.entity);
                });
            }
        }
    }
Ejemplo n.º 8
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();
            }
        }
Ejemplo n.º 9
0
        void UpdateSwitchWeapon()
        {
            if (m_SwitchWeapon)
            {
                if (null == m_OldWeapon || m_OldWeapon.Equals(null) || null == m_NewWeapon || m_NewWeapon.Equals(null))
                {
                    m_SwitchWeapon = false;
                    return;
                }

                if (m_PutOnNewWeapon && m_MotionMgr.IsActionRunning(m_NewWeapon.m_HandChangeAttr.m_ActiveActionType))
                {
                    m_SwitchWeapon = false;
                    return;
                }
                else
                {
                    if (m_MotionMgr.IsActionRunning(m_OldWeapon.m_HandChangeAttr.m_ActiveActionType))
                    {
                        ActiveEquipment(m_OldWeapon, false);
                    }
                    else if (!m_MotionMgr.IsActionRunning(m_NewWeapon.m_HandChangeAttr.m_ActiveActionType))
                    {
                        m_PutOnNewWeapon = true;
                        ActiveEquipment(m_NewWeapon, true);
                    }
                }
            }
        }
Ejemplo n.º 10
0
 public bool IsActionRunning(PEActionType type)
 {
     return(m_Motion != null && m_Motion.IsActionRunning(type));
 }