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); }
/// <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); }
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); }
/// <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); }
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); } }
public bool RequestGetOnTrain(int routeId, int entityId) { if (!GameConfig.IsMultiMode) { return(DoGetOnTrain(entityId, routeId)); } else { Pathea.PeEntity entity = Pathea.EntityMgr.Instance.Get(entityId); if (null == entity) { Debug.LogError("cant find entity:" + entityId); return(false); } Pathea.MotionMgrCmpt mmc = entity.GetCmpt <Pathea.MotionMgrCmpt>(); if (null == mmc) { Debug.LogError("no Pathea.RailPassengerCmpt"); return(false); } if (mmc.CanDoAction(Pathea.PEActionType.GetOnTrain)) { if (null != PlayerNetwork.mainPlayer) { PlayerNetwork.mainPlayer.RPCServer(EPacketType.PT_InGame_Railway_GetOnTrain, routeId, entityId); } } return(true); } }
public override void Start() { base.Start(); if (null != Entity.aliveEntity) { Entity.aliveEntity.deathEvent += OnDeath; } m_MotionMgr = Entity.motionMgr; if (null != m_MotionMgr) { m_Sleep = new Action_Sleep(); m_Gather = new Action_Gather(); m_MotionMgr.AddAction(m_Sleep); m_MotionMgr.AddAction(new Action_Eat()); m_MotionMgr.AddAction(m_Gather); m_MotionMgr.AddAction(new Action_PickUpItem()); m_MotionMgr.AddAction(new Action_Sit()); m_MotionMgr.AddAction(new Action_Stuned()); m_MotionMgr.AddAction(new Action_Build()); m_MotionMgr.AddAction(new Action_Operation()); m_MotionMgr.AddAction(new Action_Lie()); m_MotionMgr.AddAction(new Action_Cutscene()); m_MotionMgr.AddAction(new Action_Cure()); m_MotionMgr.AddAction(new Action_Leisure()); m_MotionMgr.AddAction(new Action_Abnormal()); m_MotionMgr.AddAction(m_Hand); m_MotionMgr.AddAction(m_Handed); } }
public override void Start() { base.Start(); mMove = Entity.GetCmpt <Motion_Move>(); mTrans = Entity.peTrans; mMotionMgr = Entity.GetCmpt <MotionMgrCmpt>(); }
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); } } }
public void EnterBuildMode() { if (null != Pathea.PeCreature.Instance && null != Pathea.PeCreature.Instance.mainPlayer) { Pathea.MotionMgrCmpt mmc = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.MotionMgrCmpt>(); if (null != mmc) { mmc.DoAction(Pathea.PEActionType.Build); } } }
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); } }
public void QuitBuildMode() { if (null != Pathea.PeCreature.Instance && null != Pathea.PeCreature.Instance.mainPlayer) { Pathea.MotionMgrCmpt mmc = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.MotionMgrCmpt>(); if (null != mmc) { mmc.EndAction(Pathea.PEActionType.Build); } } else { QuitBlock(); } }
public override void Start() { base.Start(); m_MoveState = new List <Vector3> (MoveRecordCount); m_MoveRequest = new List <Vector3> (MoveRequestCount); gMainPlayer = this; gameObject.AddComponent <Scanner> (); mMove = Entity.GetCmpt <Motion_Move_Human> (); mEquip = Entity.motionEquipment; mView = Entity.biologyViewCmpt; mTrans = Entity.peTrans; mIK = Entity.GetCmpt <IKCmpt> (); m_Skill = Entity.aliveEntity; mPackage = Entity.GetCmpt <PackageCmpt> (); mPassenger = Entity.passengerCmpt; mMotionMgr = Entity.motionMgr; mMotionMgr.onActionStart += OnActionStart; mMotionMgr.onActionEnd += OnActionEnd; m_Abnormalcmpt = Entity.Alnormal; if (null != m_Abnormalcmpt) { m_Abnormalcmpt.evtStart += OnStartAbnormal; m_Abnormalcmpt.evtEnd += OnEndAbnormal; } if (null != m_Skill) { m_Skill.onHpReduce += OnDamage; m_Skill.attackEvent += OnAttack; m_Skill.deathEvent += OnDeath; m_Skill.onSkillEvent += OnSkillTarget; m_Skill.onWeaponAttack += OnWeaponAttack; m_Skill.OnBeEnemyEnter += OnBeEnemyEnter; } if (!PeGameMgr.IsTutorial) { StartCoroutine(UpdateAbnormalNotice()); } //历险模式下此时初始化声望系统,ForceSetting并未加载,会导致声望系统不能正常起作用 //InitReputationSystem(); Invoke("CheckAbnormalState", 5f); }
public override void Start() { base.Start(); mPeTrans = Entity.peTrans; mSkEntity = Entity.GetComponent <PESkEntity>(); mMotionMgr = Entity.GetCmpt <MotionMgrCmpt>(); if (mRailRouteId != Railway.Manager.InvalId) { if (null != Railway.Manager.Instance.GetRoute(mRailRouteId)) { DoGetOn(mRailRouteId, true); } else { mRailRouteId = Railway.Manager.InvalId; } } }
void Start() { if (_fpSeedGoLR == null) { return; } try{ _cntFootPrint = GetComponentInParent <Pathea.MainPlayerCmpt>() != null ? CntFootPrintPlayer : CntFootPrintNPC; _fpGoUpdates = new FootprintDecal[2, _cntFootPrint]; _mmc = GetComponentInParent <Pathea.MotionMgrCmpt>(); int sex = _mmc.GetComponent <Pathea.CommonCmpt>().sex == Pathea.PeSex.Male ? 0 : 1; Texture tex = Resources.Load(sex == 1 ? "Texture2D/footprint_f" : "Texture2D/footprint_m") as Texture; _fpSeedGoLR.GetComponent <Renderer>().sharedMaterial.mainTexture = tex; FootprintDecalMgr.Instance.Register(this); } catch {} }
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); }); } } }
public override void Start() { base.Start(); m_SkillCmpt = Entity.aliveEntity; m_PeTrans = Entity.peTrans; m_Repulsed.m_Behave = Entity.GetCmpt <BehaveCmpt>(); m_Repulsed.m_Move = Entity.GetCmpt <Motion_Move_Motor>(); m_MotionMgr = Entity.motionMgr; if (null != m_MotionMgr) { m_MotionMgr.AddAction(m_Whacked); m_MotionMgr.AddAction(m_Repulsed); m_MotionMgr.AddAction(m_Wentfly); m_MotionMgr.AddAction(m_Knocked); m_MotionMgr.AddAction(m_GetUp); m_MotionMgr.AddAction(m_Death); m_MotionMgr.AddAction(m_AlienDeath); m_MotionMgr.AddAction(m_Revive); } }
public void CloseMission_buildCreateISO() { GameObject.Destroy(isoCube1); GameObject.Destroy(isoCube2); BSBlock45Data.voxelWrite -= AddRecordVoxel; BSVoxel vol = new BSVoxel(0, 0); for (int i = 0; i < recordVoxelRemove.Count; i++) { int[] tmp = recordVoxelRemove[i]; BuildingMan.Blocks.SafeWrite(vol, tmp[0], tmp[1], tmp[2]); } Pathea.MotionMgrCmpt mmc = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.MotionMgrCmpt>(); if (mmc != null) { mmc.EndAction(Pathea.PEActionType.Build); } receiverGroup.SetActive(false); DestroyTerrian(); }
void Start() { if (!m_Init) { InitSkEntity(); } Entity.AddMsgListener(this); m_CollisionEntities = new Dictionary <Collider, List <Collider> >(); m_View = Entity.viewCmpt; m_Trans = Entity.peTrans; m_Animator = Entity.animCmpt; m_Beat = Entity.GetCmpt <Motion_Beat>(); m_MotionMgr = Entity.motionMgr; m_MotionEquip = Entity.GetCmpt <Motion_Equip>(); m_Live = Entity.GetCmpt <Motion_Live>(); onHpChange += OnHpChange; onSkillEvent += OnTargetSkill; onTranslate += OnTranslate; Invoke("CheckInitAttr", 0.5f); }
public RunningAction(MotionMgrCmpt mmc) { m_MotionMgr = mmc; }
public override void Start() { base.Start(); mView = Entity.biologyViewCmpt; mMotionMgr = Entity.motionMgr; }
void InitAction() { m_Trans = Entity.peTrans; m_Skill = Entity.aliveEntity; m_Skill.onSheildReduce += OnSheildReduce; m_View = Entity.biologyViewCmpt; m_EquipCmpt = Entity.equipmentCmpt; m_Package = Entity.packageCmpt; m_NPC = Entity.NpcCmpt; m_Anim = Entity.animCmpt; m_MotionMgr = Entity.motionMgr; Invoke("CheckGloves", 0.5f); m_HeavyEquipmentCtrl.moveCmpt = Entity.motionMove as Motion_Move_Human; m_HeavyEquipmentCtrl.ikCmpt = Entity.IKCmpt; m_HeavyEquipmentCtrl.motionMgr = m_MotionMgr; // m_ChainSawActive.anim = anim; m_SwordAttack.m_UseStamina = isMainPlayer; m_TwoHandWeaponAttack.m_UseStamina = isMainPlayer; //Gun m_GunFire.m_gunHold = m_GunHold; m_HandChangeHold.onActiveEvt += OnActiveEquipment; m_HandChangeHold.onDeactiveEvt += OnDeactiveEquipment; m_TwoHandWeaponHold.onActiveEvt += OnActiveEquipment; m_TwoHandWeaponHold.onDeactiveEvt += OnDeactiveEquipment; m_GunHold.onActiveEvt += OnActiveEquipment; m_GunHold.onDeactiveEvt += OnDeactiveEquipment; m_BowHold.onActiveEvt += OnActiveEquipment; m_BowHold.onDeactiveEvt += OnDeactiveEquipment; m_AimEquipHold.onActiveEvt += OnActiveEquipment; m_AimEquipHold.onDeactiveEvt += OnDeactiveEquipment; if (null != m_MotionMgr) { m_MotionMgr.onActionEnd += OnActionEnd; m_MotionMgr.AddAction(m_HandChangeHold); m_MotionMgr.AddAction(m_HandChangePutOff); m_MotionMgr.AddAction(m_SwordAttack); m_MotionMgr.AddAction(m_TwoHandWeaponHold); m_MotionMgr.AddAction(m_TwoHandWeaponPutOff); m_MotionMgr.AddAction(m_TwoHandWeaponAttack); m_MotionMgr.AddAction(m_SheildHold); m_MotionMgr.AddAction(m_GunHold); m_MotionMgr.AddAction(m_GunPutOff); m_MotionMgr.AddAction(m_GunFire); m_MotionMgr.AddAction(m_GunReload); m_MotionMgr.AddAction(m_GunMelee); m_MotionMgr.AddAction(m_BowHold); m_MotionMgr.AddAction(m_BowPutOff); m_MotionMgr.AddAction(m_BowShoot); m_MotionMgr.AddAction(m_BowReload); m_MotionMgr.AddAction(m_AimEquipHold); m_MotionMgr.AddAction(m_AimEquipPutOff); m_MotionMgr.AddAction(m_DigTerrain); m_MotionMgr.AddAction(m_Fell); m_MotionMgr.AddAction(m_JetPackAction); m_MotionMgr.AddAction(m_ParachuteAction); m_MotionMgr.AddAction(m_GliderAction); m_MotionMgr.AddAction(m_DrawWater); m_MotionMgr.AddAction(m_PumpWater); m_MotionMgr.AddAction(m_ThrowGrenade); m_MotionMgr.AddAction(m_FlashLightAction); m_MotionMgr.AddAction(m_RopeGunAction); } }
public void StartLoadScene() { for (int i = 0; i < 100; i++) { PeLauncher.Instance.Add(new GameLoader.Dummy()); } bFirstRun = true; PeLauncher.Instance.endLaunch = delegate() { if (PeGameMgr.IsMulti && !NetworkInterface.IsClient) { return(true); } if (bFirstRun) { bFirstRun = false; VFVoxelTerrain.TerrainVoxelComplete = false; return(false); } if (!VFVoxelTerrain.TerrainVoxelComplete) { return(false); } PeEntity mainPlayer = MainPlayer.Instance.entity; if (null == mainPlayer) { return(false); } MotionMgrCmpt motion = mainPlayer.GetCmpt <MotionMgrCmpt>(); if (motion == null) { return(false); } Vector3 safePos; if (PeGameMgr.IsMulti) { if (PlayerNetwork.mainPlayer != null && PlayerNetwork.mainPlayer._curSceneId == (int)Pathea.SingleGameStory.StoryScene.MainLand) { if (PETools.PE.FindHumanSafePos(mainPlayer.position, out safePos, 10)) { mainPlayer.position = safePos; motion.FreezePhySteateForSystem(false); } else { mainPlayer.position += 10 * Vector3.up; motion.FreezePhySteateForSystem(true); return(false); } } } else { if (PETools.PE.FindHumanSafePos(mainPlayer.position, out safePos, 10)) { mainPlayer.position = safePos; motion.FreezePhySteateForSystem(false); } else { mainPlayer.position += 10 * Vector3.up; motion.FreezePhySteateForSystem(true); return(false); } } Object.Destroy(gameObject); Resources.UnloadUnusedAssets(); System.GC.Collect(); return(true); }; PeLauncher.Instance.StartLoad(); }
public override void Start() { base.Start(); m_Motion = GetComponent <MotionMgrCmpt>(); }