void OnUpdateRotationFast(ref MyEventUpdateRotationFast msg) { MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("Update rotation fast"); MyPlayerRemote player = (MyPlayerRemote)msg.SenderConnection.Tag; MyEntityIdentifier entityId = new MyEntityIdentifier(msg.EntityId); if (!CheckSenderId(msg, msg.EntityId)) { Alert("Player is updating entity which is not his", msg.SenderEndpoint, msg.EventType); return; } MyEntity entity; if (MyEntities.TryGetEntityById(entityId, out entity)) { if (entity is MyPrefabLargeWeapon) { var gun = ((MyPrefabLargeWeapon)entity).GetGun(); gun.SetRotationAndElevation(msg.Rotation); } } else { Alert("Entity to update not found", msg.SenderEndpoint, msg.EventType); } MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); }
public void UpdateRotationFast(MyEntity entity, Vector3 rotation) { Debug.Assert(entity != null); Debug.Assert(!entity.Closed); Debug.Assert(entity.EntityId.HasValue); var posMsg = new MyEventUpdateRotationFast(); posMsg.EntityId = entity.EntityId.Value.NumericValue; posMsg.Rotation = rotation; Peers.SendToAll(ref posMsg, entity.EntityId.Value, m_multiplayerConfig.RotationTickRate, NetDeliveryMethod.ReliableSequenced, 4); }