2022-01-14 07:38:45 +00:00
|
|
|
|
using Mirror;
|
|
|
|
|
using QSB.Messaging;
|
2021-12-24 15:25:13 +00:00
|
|
|
|
using QSB.QuantumSync.WorldObjects;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
namespace QSB.QuantumSync.Messages;
|
|
|
|
|
|
2023-07-28 18:30:57 +00:00
|
|
|
|
public class EyeProxyMoonStateChangeMessage : QSBWorldObjectMessage<QSBEyeProxyQuantumMoon>
|
2021-12-24 15:25:13 +00:00
|
|
|
|
{
|
2022-03-03 03:46:33 +00:00
|
|
|
|
private bool Active;
|
|
|
|
|
private float Angle;
|
2021-12-24 15:25:13 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public EyeProxyMoonStateChangeMessage(bool active, float angle)
|
|
|
|
|
{
|
|
|
|
|
Active = active;
|
|
|
|
|
Angle = angle;
|
|
|
|
|
}
|
2021-12-24 15:25:13 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public override void Serialize(NetworkWriter writer)
|
|
|
|
|
{
|
|
|
|
|
base.Serialize(writer);
|
|
|
|
|
writer.Write(Active);
|
|
|
|
|
writer.Write(Angle);
|
|
|
|
|
}
|
2021-12-25 04:46:37 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public override void Deserialize(NetworkReader reader)
|
|
|
|
|
{
|
|
|
|
|
base.Deserialize(reader);
|
|
|
|
|
Active = reader.Read<bool>();
|
|
|
|
|
Angle = reader.Read<float>();
|
|
|
|
|
}
|
2022-02-27 12:40:44 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public override void OnReceiveRemote()
|
|
|
|
|
{
|
|
|
|
|
WorldObject.AttachedObject._moonStateRoot.SetActive(Active);
|
|
|
|
|
if (Angle != -1f)
|
2021-12-24 15:25:13 +00:00
|
|
|
|
{
|
2022-03-03 03:46:33 +00:00
|
|
|
|
WorldObject.AttachedObject.transform.localEulerAngles = new Vector3(0f, Angle, 0f);
|
2021-12-24 15:25:13 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-25 06:04:54 +00:00
|
|
|
|
}
|