30 lines
688 B
C#
Raw Normal View History

2022-05-28 13:57:32 -07:00
using QSB.Messaging;
using QSB.Player;
namespace QSB.EchoesOfTheEye.LightSensorSync.Messages;
internal class PlayerSetIlluminatedMessage : QSBMessage<(uint playerId, bool illuminated)>
2022-05-28 13:57:32 -07:00
{
public PlayerSetIlluminatedMessage(uint playerId, bool illuminated) : base((playerId, illuminated)) { }
2022-05-28 13:57:32 -07:00
2022-08-16 16:39:47 -07:00
public override void OnReceiveRemote()
{
var lightSensor = (SingleLightSensor)QSBPlayerManager.GetPlayer(Data.playerId).LightSensor;
if (lightSensor._illuminated == Data.illuminated)
{
return;
}
lightSensor._illuminated = Data.illuminated;
if (Data.illuminated)
{
lightSensor.OnDetectLight.Invoke();
}
else
{
lightSensor.OnDetectDarkness.Invoke();
}
}
2022-05-28 13:57:32 -07:00
}