quantum-space-buddies/QSB/EchoesOfTheEye/Prisoner/Messages/PrisonerEnterBehaviourMessage.cs
2022-04-22 18:29:50 +01:00

19 lines
698 B
C#

using QSB.EchoesOfTheEye.Prisoner.WorldObjects;
using QSB.Messaging;
using QSB.WorldSync;
namespace QSB.EchoesOfTheEye.Prisoner.Messages;
internal class PrisonerEnterBehaviourMessage : QSBWorldObjectMessage<QSBPrisonerBrain, (PrisonerBehavior behaviour, int markerIndex)>
{
public PrisonerEnterBehaviourMessage(PrisonerBehavior behaviour, PrisonerBehaviourCueMarker marker)
: base((behaviour, marker != null ? marker.GetWorldObject<QSBPrisonerMarker>().ObjectId : -1)) { }
public override void OnReceiveRemote()
{
var marker = (Data.markerIndex == -1) ? null : Data.markerIndex.GetWorldObject<QSBPrisonerMarker>().Transform;
WorldObject.EnterBehaviour(Data.behaviour, marker);
}
}