/// <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);
 }
    /// <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);
    }
Beispiel #3
0
        // Update is called once per frame
        void Update()
        {
            if (hasOperator && mSleepEntity == null)
            {
                OperateCmpt cmpt = Operator as OperateCmpt;
                if (cmpt != null)
                {
                    mSleepEntity = cmpt.Entity;
                }
            }

            if (mSleepEntity != null && mSleepEntity.Alnormal != null)
            {
                if (REOVE_TIME != 0)
                {
                    if (Time.time - mStartLayTime >= REOVE_TIME && !mIsPase)
                    {
                        //时间到了,正常结束动作
                        if (Operator != null && !Operator.Equals(null) && Operator.Operate != null && !Operator.Operate.Equals(null)) // && Operator.Operate.ContainsOperator(Operator) && Operator.IsActionRunning(PEActionType.Sleep)
                        {
                            bool IsEnd = Operator.Operate.StopOperate(Operator, EOperationMask.Sleep);
                            if (IsEnd && mSleepEntity != null && mSleepEntity.NpcCmpt != null)
                            {
                                mSleepEntity.NpcCmpt.IsNeedMedicine = false;
                                EndAlnormal(mSleepEntity);
                                mSleepEntity = null;
                            }
                        }
                        else if (mSleepEntity != null && mSleepEntity.NpcCmpt != null) //被打断结束了动作
                        {
                            mSleepEntity.NpcCmpt.IsNeedMedicine = false;
                            EndAlnormal(mSleepEntity);
                            mSleepEntity = null;
                        }
                    }
                }
            }
        }