diff --git a/Assets/Scripts/Rope/GameState.cs b/Assets/Scripts/Rope/GameState.cs index c4887a9..cffecae 100644 --- a/Assets/Scripts/Rope/GameState.cs +++ b/Assets/Scripts/Rope/GameState.cs @@ -1,10 +1,12 @@ using Unity.Netcode; +using UnityEngine; [System.Serializable] public struct GameState : INetworkSerializable { public int tick; public NetworkRope nrope; + public Vector2[] enemyPositions; public override int GetHashCode() { @@ -20,6 +22,7 @@ public struct GameState : INetworkSerializable public void NetworkSerialize(BufferSerializer serializer) where T : IReaderWriter { serializer.SerializeValue(ref tick); + serializer.SerializeValue(ref enemyPositions); nrope.NetworkSerialize(serializer); } } diff --git a/Assets/Scripts/Rope/RopeSimulator.cs b/Assets/Scripts/Rope/RopeSimulator.cs index ef49443..4078fee 100644 --- a/Assets/Scripts/Rope/RopeSimulator.cs +++ b/Assets/Scripts/Rope/RopeSimulator.cs @@ -4,7 +4,6 @@ using System.Linq; using Unity.Netcode; using UnityEngine; using UnityEngine.Assertions; -using Utilities; using UnityUtils; public class RopeSimulator : NetworkBehaviour @@ -315,7 +314,8 @@ public class RopeSimulator : NetworkBehaviour { GameState localState = new() { tick = currentTick, - nrope = Rope.ToNetworkRope(this.rope) + nrope = Rope.ToNetworkRope(this.rope), + enemyPositions = GameObject.FindObjectsByType(FindObjectsSortMode.None).Select(e => new Vector2(e.transform.position.x, e.transform.position.y)).ToArray() }; return localState;