27 lines
625 B
C#
Raw Normal View History

using Mirror;
using QSB.Messaging;
2021-12-23 01:50:09 -08:00
using QSB.OrbSync.WorldObjects;
2020-12-07 18:49:51 +00:00
2022-03-02 19:46:33 -08:00
namespace QSB.OrbSync.Messages;
2021-12-23 01:50:09 -08:00
2022-03-02 19:46:33 -08:00
public class OrbSlotMessage : QSBWorldObjectMessage<QSBOrb, int>
{
private bool _playAudio;
2021-12-23 01:50:09 -08:00
2022-03-10 17:57:50 -08:00
public OrbSlotMessage(int slotIndex, bool playAudio) : base(slotIndex) =>
2022-03-02 19:46:33 -08:00
_playAudio = playAudio;
2022-03-02 19:46:33 -08:00
public override void Serialize(NetworkWriter writer)
{
base.Serialize(writer);
writer.Write(_playAudio);
}
2022-03-02 19:46:33 -08:00
public override void Deserialize(NetworkReader reader)
{
base.Deserialize(reader);
_playAudio = reader.Read<bool>();
}
2022-03-02 19:46:33 -08:00
public override void OnReceiveRemote() => WorldObject.SetSlot(Data, _playAudio);
}