2024-07-15 17:00:04 +03:00
|
|
|
using Syntriax.Engine.Core;
|
|
|
|
|
|
|
|
using Syntriax.Engine.Network.Abstract;
|
|
|
|
|
|
|
|
namespace Syntriax.Engine.Network;
|
|
|
|
|
|
|
|
public class NetworkManager : NetworkBehaviour, INetworkManager
|
|
|
|
{
|
|
|
|
private BehaviourCollector<INetworkEntity> entities = null!;
|
|
|
|
|
|
|
|
private static uint networkIdIndex = 0;
|
|
|
|
|
|
|
|
protected override void OnInitialize()
|
|
|
|
{
|
|
|
|
base.OnInitialize();
|
|
|
|
|
|
|
|
NetworkId = networkIdIndex++;
|
|
|
|
|
|
|
|
entities = new(GameObject.GameManager);
|
|
|
|
foreach (var entity in entities)
|
|
|
|
entity.NetworkId = networkIdIndex++;
|
|
|
|
|
|
|
|
entities.OnCollected += OnCollected;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnCollected(BehaviourCollector<INetworkEntity> collector, INetworkEntity entity)
|
|
|
|
=> entity.NetworkId = networkIdIndex++;
|
2024-07-18 23:07:05 +03:00
|
|
|
|
|
|
|
public override void ReceiveData<T>(T data) { }
|
2024-07-15 17:00:04 +03:00
|
|
|
}
|