2022-08-28 04:05:00 +00:00
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
using QSB.ShipSync;
|
|
|
|
|
using QSB.WorldSync;
|
|
|
|
|
|
|
|
|
|
namespace QSB.Audio.Messages;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ShipThrusterAudioOneShotMessage : QSBMessage<(AudioType audioType, float pitch, float volume)>
|
|
|
|
|
{
|
|
|
|
|
public ShipThrusterAudioOneShotMessage(AudioType audioType, float pitch = 1f, float volume = 1f) : base((audioType, pitch, volume)) { }
|
|
|
|
|
|
|
|
|
|
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
|
|
|
|
|
|
|
|
|
|
public override void OnReceiveRemote()
|
|
|
|
|
{
|
2023-07-04 20:56:40 +00:00
|
|
|
|
var source = ShipManager.Instance?.ShipThrusterAudio?._rotationalSource;
|
|
|
|
|
|
|
|
|
|
if (source == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-28 04:05:00 +00:00
|
|
|
|
source.pitch = Data.pitch;
|
|
|
|
|
source.PlayOneShot(Data.audioType, Data.volume);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|