using Unity.Netcode; using UnityEngine; // FIXME: NetworkObject.NetworkObjectId are ulong but we're sending them as int. potential problem [System.Serializable] public struct GameState : INetworkSerializable { public int tick; public NetworkRope nrope; /// /// x & y are location coords. z component is the /// of the enemy. /// public Vector3[] enemyPositions; /// /// x & y are location coords. z component is the /// of the player. /// public Vector3[] playerPositions; public override int GetHashCode() { return tick; } public override bool Equals(object obj) { GameState other = (GameState) obj; return this.GetHashCode() == obj.GetHashCode(); } public void NetworkSerialize(BufferSerializer serializer) where T : IReaderWriter { serializer.SerializeValue(ref tick); serializer.SerializeValue(ref enemyPositions); serializer.SerializeValue(ref playerPositions); nrope.NetworkSerialize(serializer); } }