2022-08-16 23:02:22 +00:00
|
|
|
|
using QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
|
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
|
|
|
|
|
namespace QSB.EchoesOfTheEye.LightSensorSync.Messages;
|
|
|
|
|
|
2023-07-28 18:30:57 +00:00
|
|
|
|
public class SetIlluminatedMessage : QSBWorldObjectMessage<QSBLightSensor, bool>
|
2022-08-16 23:02:22 +00:00
|
|
|
|
{
|
|
|
|
|
public SetIlluminatedMessage(bool illuminated) : base(illuminated) { }
|
|
|
|
|
|
|
|
|
|
public override void OnReceiveRemote()
|
|
|
|
|
{
|
2022-08-16 23:27:56 +00:00
|
|
|
|
if (WorldObject.AttachedObject._illuminated == Data)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:02:22 +00:00
|
|
|
|
WorldObject.AttachedObject._illuminated = Data;
|
|
|
|
|
if (Data)
|
|
|
|
|
{
|
|
|
|
|
WorldObject.AttachedObject.OnDetectLight.Invoke();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
WorldObject.AttachedObject.OnDetectDarkness.Invoke();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|