private void OnCollisionEnter(Collision collision) { if (!m_IsCollision) { Rigidbody rigidbody = m_Property.GetRigidbody(); Assert.IsFalse(rigidbody == null, "rigidbody is null"); GameplayProxy gameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy; Assert.IsFalse(gameplayProxy == null, "gameplayProxy is null"); m_IsCollision = true; rigidbody.velocity = Vector3.zero; rigidbody.angularVelocity = Vector3.zero; rigidbody.freezeRotation = true; m_CollisionSet.Add(collision); if (m_Property.IsMain()) { HeroMoveHandler.SyncHitWall( true, m_Property.GetCurrentState().GetOnlyServerState(), gameplayProxy.GetCurrentAreaUid(), gameplayProxy.ClientToServerAreaOffset(rigidbody.position), rigidbody.rotation, rigidbody.velocity, rigidbody.angularVelocity ); } } }
/// <summary> /// 请求终止跃迁 /// </summary> public void RequestStopLeap(ulong currentAreaID, ulong targetAreaID) { GameplayProxy gameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy; SpacecraftEntity spacecraftEntity = gameplayProxy.GetMainPlayer(); Assert.IsTrue(spacecraftEntity != null, "gameplayProxy.GetMainPlayer() is null !!!"); Rigidbody rigidbody = spacecraftEntity.GetRigidbody(); Assert.IsTrue(rigidbody != null, "rigidbody is null !!!"); HeroMoveHandler.SyncLeapCancel( spacecraftEntity.GetCurrentState().GetOnlyServerState(), (uint)currentAreaID, gameplayProxy.ClientToServerAreaOffset(rigidbody.position), rigidbody.rotation, rigidbody.velocity, rigidbody.angularVelocity); }
private void SendShipNew(Vector3 rotateAxis, Vector3 engineAxis) { if (m_Property.GetMotionType() == MotionType.Mmo) { HeroMoveHandler.SyncMMoMove( engineAxis, rotateAxis, m_Property.GetCurrentState().GetOnlyServerState(), (uint)m_GameplayProxy.GetCurrentAreaUid(), m_GameplayProxy.ClientToServerAreaOffset(m_Rigidbody.position), m_Rigidbody.rotation, m_Rigidbody.velocity, m_Rigidbody.angularVelocity ); } else if (m_Property.GetMotionType() == MotionType.Dof4) { HeroMoveHandler.SyncDof4Move( engineAxis, rotateAxis, m_Property.GetCurrentState().GetOnlyServerState(), (uint)m_GameplayProxy.GetCurrentAreaUid(), m_GameplayProxy.ClientToServerAreaOffset(m_Rigidbody.position), m_Rigidbody.rotation, m_Rigidbody.velocity, m_Rigidbody.angularVelocity ); } else if (m_Property.GetMotionType() == MotionType.Dof6) { HeroMoveHandler.SyncDof6Move( engineAxis, rotateAxis, m_Property.GetCurrentState().GetOnlyServerState(), (uint)m_GameplayProxy.GetCurrentAreaUid(), m_GameplayProxy.ClientToServerAreaOffset(m_Rigidbody.position), m_Rigidbody.rotation, m_Rigidbody.velocity, m_Rigidbody.angularVelocity ); } }
public override void OnInitialize(ISpacecraftMotionProperty property) { m_Property = property; m_Transform = m_Property.GetRootTransform(); m_Rigidbody = m_Property.GetRigidbody(); m_GameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy; InitializeMovionAttribute(); m_BehaviorController = m_Property.GetBehaviorController(); m_BehaviorController.Callback += OnBehaviorControllerEvent; RefreshSpacecraftMotionState(); /// TODO 创建运动流 if (m_Property.IsMain()) { HeroMoveHandler.StartHeroMoveStream(); } }