void OnDeath(SkEntity self, SkEntity caster) { if (Entity.Race == ERace.Paja || Entity.Race == ERace.Puja) { m_MotionMgr.DoAction(PEActionType.AlienDeath); } else { m_MotionMgr.DoAction(PEActionType.Death); } }
void UpdateAutoUseEquipment() { if (null != m_Parachute) { m_MotionMgr.DoAction(PEActionType.Parachute); } if (null != m_Glider) { m_MotionMgr.DoAction(PEActionType.Glider); } if (null != m_DigTool) { m_DigTerrain.UpdateDigPos(); } }
public bool DoAction(PEActionType type, PEActionParam para) { if (m_Motion != null) { return(m_Motion.DoAction(type, para)); } return(false); }
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 void GetOn(WhiteCat.CarrierController controller, int seatIndex, bool checkState) { if (null != mMotionMgr) { PEActionParamDrive param = PEActionParamDrive.param; param.controller = controller; param.seatIndex = seatIndex; if (!checkState) { mMotionMgr.DoActionImmediately(PEActionType.Drive, param); OnGetOnSucceed(controller, seatIndex); } else if (mMotionMgr.DoAction(PEActionType.Drive, param)) { OnGetOnSucceed(controller, seatIndex); } } }
void ApplyMoveEffect(SkEntity skEntity, Transform trans, Vector3 forceDir, float forcePower) { if (null == m_Param) { return; } float angle = Vector3.Angle(m_PeTrans.existent.forward, forceDir); float thresholdScale = m_Param.m_AngleThresholdScale.Evaluate(angle); forcePower *= m_Param.m_AngleForceScale.Evaluate(angle); thresholdScale *= m_MotionMgr.GetMaskState(PEActionMask.InAir) ? m_Param.m_ThresholdScaleInAir : 1f; EffectType spType = EffectType.Repulsed; if (forcePower < m_SkillCmpt.GetAttribute(AttribType.ThresholdWhacked) * thresholdScale) { spType = EffectType.Null; } else if (forcePower < m_SkillCmpt.GetAttribute(AttribType.ThresholdRepulsed) * thresholdScale) { spType = EffectType.Whacked; } else if (forcePower < m_SkillCmpt.GetAttribute(AttribType.ThresholdWentfly) * thresholdScale) { spType = EffectType.Repulsed; } else if (forcePower < m_SkillCmpt.GetAttribute(AttribType.ThresholdKnocked) * thresholdScale) { spType = EffectType.Wentfly; } else { spType = EffectType.Knocked; } #if UNITY_EDITOR if (m_WriteLog) { Debug.LogError("ForcePower:" + forcePower); Debug.LogError("ThresholdRepulsed:" + m_SkillCmpt.GetAttribute(AttribType.ThresholdRepulsed).ToString()); Debug.LogError(spType.ToString()); } #endif SkAliveEntity skAliveEntity = skEntity as SkAliveEntity; if (null != skAliveEntity) { switch (spType) { case EffectType.Null: ApplyHitEffect(trans, forceDir, forcePower); break; case EffectType.Whacked: m_MotionMgr.DoAction(PEActionType.Whacked); break; case EffectType.Repulsed: ApplyHitEffect(trans, forceDir, forcePower); PEActionParamVVF param = PEActionParamVVF.param; param.vec1 = m_PeTrans.position; param.vec2 = forceDir; param.f = forcePower; m_MotionMgr.DoAction(PEActionType.Repulsed, param); break; case EffectType.Wentfly: case EffectType.Knocked: PEActionParamVFNS paramVFNS = PEActionParamVFNS.param; paramVFNS.vec = forceDir; paramVFNS.f = forcePower; paramVFNS.n = skAliveEntity.Entity.Id; if (null != trans) { paramVFNS.str = trans.name; } else { paramVFNS.str = ""; } m_MotionMgr.DoAction(PEActionType.Wentfly, paramVFNS); break; } } }
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(); } }