public override void Process(PlayFMODStudioEmitter packet) { GameObject soundSource = NitroxEntity.RequireObjectFrom(packet.Id); FMODEmitterController fmodEmitterController = soundSource.RequireComponent <FMODEmitterController>(); using (packetSender.Suppress <PlayFMODStudioEmitter>()) { if (packet.Play) { fmodEmitterController.PlayStudioEmitter(packet.AssetPath); } else { fmodEmitterController.StopStudioEmitter(packet.AssetPath, packet.AllowFadeout); } } }
public override void Process(PlayFMODStudioEmitter packet) { Optional <GameObject> soundSource = NitroxEntity.GetObjectFrom(packet.Id); Validate.IsPresent(soundSource); FMODEmitterController fmodEmitterController = soundSource.Value.GetComponent <FMODEmitterController>(); Validate.IsTrue(fmodEmitterController); using (packetSender.Suppress <PlayFMODStudioEmitter>()) { if (packet.Play) { fmodEmitterController.PlayStudioEmitter(packet.AssetPath); } else { fmodEmitterController.StopStudioEmitter(packet.AssetPath, packet.AllowFadeout); } } }