mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-30 03:32:47 +00:00
Sync ship ignition audio
This commit is contained in:
parent
232aec2a52
commit
768b47c81c
@ -33,4 +33,7 @@ public static class OWEvents
|
||||
public const string ExitDreamWorld = nameof(ExitDreamWorld);
|
||||
public const string EnterRemoteFlightConsole = nameof(EnterRemoteFlightConsole);
|
||||
public const string ExitRemoteFlightConsole = nameof(ExitRemoteFlightConsole);
|
||||
public const string StartShipIgnition = nameof(StartShipIgnition);
|
||||
public const string CompleteShipIgnition = nameof(CompleteShipIgnition);
|
||||
public const string CancelShipIgnition = nameof(CancelShipIgnition);
|
||||
}
|
48
QSB/ShipSync/Messages/ShipIgnitionMessage.cs
Normal file
48
QSB/ShipSync/Messages/ShipIgnitionMessage.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using QSB.Messaging;
|
||||
using QSB.Player;
|
||||
using static QSB.ShipSync.Messages.ShipIgnitionMessage;
|
||||
|
||||
namespace QSB.ShipSync.Messages;
|
||||
|
||||
internal class ShipIgnitionMessage : QSBMessage<ShipIgnitionType>
|
||||
{
|
||||
public enum ShipIgnitionType
|
||||
{
|
||||
START_IGNITION,
|
||||
COMPLETE_IGNITION,
|
||||
CANCEL_IGNITION
|
||||
}
|
||||
|
||||
static ShipIgnitionMessage()
|
||||
{
|
||||
GlobalMessenger.AddListener(OWEvents.StartShipIgnition, () => Handler(ShipIgnitionType.START_IGNITION));
|
||||
GlobalMessenger.AddListener(OWEvents.CompleteShipIgnition, () => Handler(ShipIgnitionType.COMPLETE_IGNITION));
|
||||
GlobalMessenger.AddListener(OWEvents.CancelShipIgnition, () => Handler(ShipIgnitionType.CANCEL_IGNITION));
|
||||
}
|
||||
|
||||
public ShipIgnitionMessage(ShipIgnitionType data) : base(data) { }
|
||||
|
||||
private static void Handler(ShipIgnitionType type)
|
||||
{
|
||||
if (QSBPlayerManager.LocalPlayer.FlyingShip)
|
||||
{
|
||||
new ShipIgnitionMessage(type).Send();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
switch (Data)
|
||||
{
|
||||
case ShipIgnitionType.START_IGNITION:
|
||||
GlobalMessenger.FireEvent(OWEvents.StartShipIgnition);
|
||||
break;
|
||||
case ShipIgnitionType.COMPLETE_IGNITION:
|
||||
GlobalMessenger.FireEvent(OWEvents.CompleteShipIgnition);
|
||||
break;
|
||||
case ShipIgnitionType.CANCEL_IGNITION:
|
||||
GlobalMessenger.FireEvent(OWEvents.CancelShipIgnition);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -136,6 +136,9 @@ internal class ShipManager : WorldObjectManager
|
||||
|
||||
QSBWorldSync.Init<QSBShipDetachableModule, ShipDetachableModule>();
|
||||
QSBWorldSync.Init<QSBShipDetachableLeg, ShipDetachableLeg>();
|
||||
|
||||
// Make sure ignition source is 3D
|
||||
QSBWorldSync.GetUnityObject<ShipThrusterAudio>()._ignitionSource.spatialBlend = 1f;
|
||||
}
|
||||
|
||||
public override void UnbuildWorldObjects()
|
||||
|
Loading…
x
Reference in New Issue
Block a user