2022-03-14 07:14:27 -07:00
|
|
|
|
using Mirror;
|
|
|
|
|
using QSB.EchoesOfTheEye.AirlockSync.WorldObjects;
|
2022-03-13 21:44:04 +00:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace QSB.EchoesOfTheEye.AirlockSync.VariableSync;
|
|
|
|
|
|
2022-03-14 19:49:38 +00:00
|
|
|
|
internal class AirlockVariableSyncer : RotatingElementsVariableSyncer<QSBAirlockInterface>
|
2022-03-13 21:44:04 +00:00
|
|
|
|
{
|
2022-03-14 19:49:38 +00:00
|
|
|
|
protected override Transform[] RotatingElements => WorldObject.AttachedObject._rotatingElements;
|
2022-03-14 07:14:27 -07:00
|
|
|
|
|
|
|
|
|
protected override void Serialize(NetworkWriter writer)
|
|
|
|
|
{
|
|
|
|
|
base.Serialize(writer);
|
|
|
|
|
|
2022-03-14 19:49:38 +00:00
|
|
|
|
var airlockInterface = WorldObject.AttachedObject;
|
2022-03-14 07:14:27 -07:00
|
|
|
|
writer.Write(airlockInterface._currentRotation);
|
|
|
|
|
writer.Write(airlockInterface._rotatingSpeed);
|
|
|
|
|
writer.Write(airlockInterface._rotatingDirection);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Deserialize(NetworkReader reader)
|
|
|
|
|
{
|
|
|
|
|
base.Deserialize(reader);
|
|
|
|
|
|
2022-03-14 19:49:38 +00:00
|
|
|
|
var airlockInterface = WorldObject.AttachedObject;
|
2022-03-14 07:14:27 -07:00
|
|
|
|
airlockInterface._currentRotation = reader.Read<float>();
|
|
|
|
|
airlockInterface._rotatingSpeed = reader.Read<float>();
|
|
|
|
|
airlockInterface._rotatingDirection = reader.Read<int>();
|
|
|
|
|
}
|
2022-03-13 21:44:04 +00:00
|
|
|
|
}
|