mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-18 13:23:05 +00:00
31 lines
960 B
C#
31 lines
960 B
C#
using Mirror;
|
|
using QSB.EchoesOfTheEye.AirlockSync.WorldObjects;
|
|
using UnityEngine;
|
|
|
|
namespace QSB.EchoesOfTheEye.AirlockSync.VariableSync;
|
|
|
|
internal class AirlockVariableSyncer : RotatingElementsVariableSyncer<QSBAirlockInterface>
|
|
{
|
|
protected override Transform[] RotatingElements => WorldObject.AttachedObject._rotatingElements;
|
|
|
|
protected override void Serialize(NetworkWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
|
|
var airlockInterface = WorldObject.AttachedObject;
|
|
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;
|
|
airlockInterface._currentRotation = reader.Read<float>();
|
|
airlockInterface._rotatingSpeed = reader.Read<float>();
|
|
airlockInterface._rotatingDirection = reader.Read<int>();
|
|
}
|
|
}
|