public void SendChangeParamsRequest(float virtualMass, float friction) { var msg = new ChangeParamsMsg(); msg.EntityId = m_block.EntityId; msg.VirtualMass = virtualMass; msg.Friction = friction; Sync.Layer.SendMessageToAllAndSelf(ref msg, MyTransportMessageEnum.Success); }
static void ChangeParamsSuccess(ref ChangeParamsMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var block = entity as MySpaceBall; if (block != null) { block.VirtualMass = msg.VirtualMass; block.Friction = msg.Friction; } }
static void ChangeParamsSuccess(ref ChangeParamsMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var block = entity as MySpaceBall; if (block != null) { block.VirtualMass = msg.VirtualMass; block.Friction = msg.Friction; if (Sync.IsServer) { Sync.Layer.SendMessageToAllButOne(ref msg, sender.SteamUserId, MyTransportMessageEnum.Success); } } }