fgm24/Assets/Scripts/Rope/Point.cs

33 lines
821 B
C#
Raw Normal View History

2024-02-02 21:03:44 +01:00
using UnityEngine;
2024-03-04 17:40:23 +01:00
using Unity.Netcode;
2024-02-02 21:03:44 +01:00
[System.Serializable]
2024-03-04 17:40:23 +01:00
public class Point : INetworkSerializable
2024-02-02 21:03:44 +01:00
{
2024-02-03 02:47:40 +01:00
public Vector3 position, prevPosition;
2024-02-02 21:03:44 +01:00
public bool locked;
2024-03-04 17:40:23 +01:00
public Point() {}
2024-02-03 02:47:40 +01:00
public Point(Vector3 position, bool locked = false)
2024-02-02 21:03:44 +01:00
{
this.position = position;
this.prevPosition = position;
this.locked = locked;
}
2024-03-04 17:40:23 +01:00
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);
}
}