fgm24/Assets/Scripts/Rope/Point.cs

33 lines
821 B
C#

using UnityEngine;
using Unity.Netcode;
[System.Serializable]
public class Point : INetworkSerializable
{
public Vector3 position, prevPosition;
public bool locked;
public Point() {}
public Point(Vector3 position, bool locked = false)
{
this.position = position;
this.prevPosition = position;
this.locked = locked;
}
public Point(Vector3 position, Vector3 prevPosition, bool locked = false)
{
this.position = position;
this.prevPosition = prevPosition;
this.locked = locked;
}
public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
{
serializer.SerializeValue(ref position);
serializer.SerializeValue(ref prevPosition);
serializer.SerializeValue(ref locked);
}
}