AirlockVariableSyncer: sync a couple other things ¯\_(ツ)_/¯

This commit is contained in:
JohnCorby 2022-03-14 07:14:27 -07:00
parent 5aea577e40
commit 0a9ccfd0db

View File

@ -1,4 +1,5 @@
using QSB.EchoesOfTheEye.AirlockSync.WorldObjects;
using Mirror;
using QSB.EchoesOfTheEye.AirlockSync.WorldObjects;
using UnityEngine;
namespace QSB.EchoesOfTheEye.AirlockSync.VariableSync;
@ -6,4 +7,24 @@ namespace QSB.EchoesOfTheEye.AirlockSync.VariableSync;
internal class AirlockVariableSyncer : RotatingElementsVariableSyncer<QSBGhostAirlock>
{
protected override Transform[] RotatingElements => WorldObject.AttachedObject._interface._rotatingElements;
protected override void Serialize(NetworkWriter writer)
{
base.Serialize(writer);
var airlockInterface = WorldObject.AttachedObject._interface;
writer.Write(airlockInterface._currentRotation);
writer.Write(airlockInterface._rotatingSpeed);
writer.Write(airlockInterface._rotatingDirection);
}
protected override void Deserialize(NetworkReader reader)
{
base.Deserialize(reader);
var airlockInterface = WorldObject.AttachedObject._interface;
airlockInterface._currentRotation = reader.Read<float>();
airlockInterface._rotatingSpeed = reader.Read<float>();
airlockInterface._rotatingDirection = reader.Read<int>();
}
}