quantum-space-buddies/QSB/EchoesOfTheEye/EclipseCodeControllers/Messages/RotateDialMessage.cs

26 lines
1.2 KiB
C#
Raw Normal View History

2022-03-12 11:47:44 +00:00
using QSB.EchoesOfTheEye.EclipseCodeControllers.WorldObjects;
using QSB.Messaging;
using QSB.Utility;
namespace QSB.EchoesOfTheEye.EclipseCodeControllers.Messages;
2023-07-28 18:30:57 +00:00
public class RotateDialMessage : QSBWorldObjectMessage<QSBEclipseCodeController, (bool right, int selectedDial)>
2022-03-12 11:47:44 +00:00
{
public RotateDialMessage(bool right, int selectedDial) : base((right, selectedDial)) { }
public override void OnReceiveRemote()
{
if (WorldObject.AttachedObject._selectedDial != Data.selectedDial)
{
DebugLog.ToConsole($"Warning - {WorldObject} got a RotateDialMessage, but it's _selectedDial is mismatched. Correcting...", OWML.Common.MessageType.Warning);
WorldObject.AttachedObject._selectedDial = Data.selectedDial;
WorldObject.AttachedObject.MoveSelectorToLocalPositionY(WorldObject.AttachedObject._dials[Data.selectedDial].transform.localPosition.y);
}
WorldObject.AttachedObject._dials[WorldObject.AttachedObject._selectedDial].Rotate(Data.right);
WorldObject.AttachedObject._gearInterfaceHorizontal.AddRotation(Data.right ? -45f : 45f, 0f);
WorldObject.AttachedObject._oneShotAudio.PlayOneShot(AudioType.CodeTotem_Horizontal, 1f);
WorldObject.AttachedObject._codeCheckDirty = true;
}
}