using System; using System.Threading.Tasks; using Syntriax.Engine.Core; using Syntriax.Engine.Core.Abstract; using Syntriax.Engine.Network.Abstract; namespace Syntriax.Engine.Network; public class NetworkManager : NetworkBehaviour, INetworkManager { public Action? OnNetworkGameObjectInstantiated { get; set; } = null; public INetworkCommunicator Communicator { get; private set; } = null!; private BehaviourCollector entities = null!; protected override void OnInitialize() { base.OnInitialize(); entities = new(GameObject.GameManager); } public Task Instantiate(params object?[]? args) where T : class, IGameObject { return Task.Run(() => { if (IsServer) return GameObject.GameManager.InstantiateGameObject(args); // Request Instantiation From Server int id = 0; return GameObject.GameManager.InstantiateGameObject(args); }); } }