quantum-space-buddies/QSB/EchoesOfTheEye/EclipseElevators/Messages/CallElevatorMessage.cs

25 lines
814 B
C#
Raw Normal View History

2022-03-16 13:48:43 +00:00
using QSB.EchoesOfTheEye.EclipseElevators.WorldObjects;
using QSB.Messaging;
namespace QSB.EchoesOfTheEye.EclipseElevators.Messages;
internal class CallElevatorMessage : QSBWorldObjectMessage<QSBElevatorDestination>
{
public override void OnReceiveRemote()
{
if (WorldObject.AttachedObject._gearInterface != null)
{
if (WorldObject.AttachedObject._elevator.currentLevelIdx != WorldObject.AttachedObject._floorIndex || WorldObject.AttachedObject._elevator.isMoving)
{
WorldObject.AttachedObject._gearInterface.AddRotation(90f, 1f);
}
else
{
WorldObject.AttachedObject._gearInterface.PlayFailure(true, 1f);
}
}
WorldObject.AttachedObject.OnElevatorCalled.Invoke(WorldObject.AttachedObject._floorIndex);
WorldObject.AttachedObject._interactReceiver.ResetInteraction();
}
}