public void SendPlaySound(Vector3?position, MySoundCuesEnum id) { var msg = new MyEventPlaySound(); msg.Position = position; msg.SoundEnum = (int)id; Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered); }
void OnPlaySound(ref MyEventPlaySound msg) { if (!MyMwcEnums.IsValidValue((MySoundCuesEnum)msg.SoundEnum)) { Alert("Invalid sound enum", msg.SenderEndpoint, msg.EventType); return; } if (msg.Position.HasValue) { MyScriptWrapper.PlaySound3D(msg.Position.Value, (MySoundCuesEnum)msg.SoundEnum); } else { MyScriptWrapper.PlaySound2D((MySoundCuesEnum)msg.SoundEnum); } }