1
This commit is contained in:
@@ -10,19 +10,7 @@ using UnityEngine;
|
||||
|
||||
namespace BITKit.Entities
|
||||
{
|
||||
[Serializable]
|
||||
public struct EntitiesNetSyncCommand
|
||||
{
|
||||
public byte[] Data;
|
||||
}
|
||||
[Serializable]
|
||||
public struct EntitiesNetSyncBatchCommand
|
||||
{
|
||||
public int Length;
|
||||
public int[] Ids;
|
||||
public ulong[] AddressablePaths;
|
||||
public EntitiesNetSyncCommand[] Commands;
|
||||
}
|
||||
|
||||
|
||||
public class EntitiesNetService : MonoBehaviour
|
||||
{
|
||||
@@ -39,7 +27,8 @@ namespace BITKit.Entities
|
||||
|
||||
[Inject]
|
||||
private IEntityBinaryHeader _playerHeader;
|
||||
[Inject] private IAddressable _playerAddressable;
|
||||
[Inject]
|
||||
private IAddressable _playerAddressable;
|
||||
[Inject]
|
||||
private IEntity _playerEntity;
|
||||
|
||||
@@ -57,10 +46,16 @@ namespace BITKit.Entities
|
||||
playerService.OnPlayerInitialized+=OnPlayerInitialized;
|
||||
playerService.OnPlayerDisposed += OnPlayerDisposed;
|
||||
|
||||
if (playerService.LocalPlayer)
|
||||
{
|
||||
playerService.LocalPlayer.Inject(this);
|
||||
}
|
||||
|
||||
destroyCancellationToken.Register(() =>
|
||||
{
|
||||
ticker.Remove(Tick);
|
||||
playerService.OnPlayerInitialized-=OnPlayerInitialized;
|
||||
playerService.OnPlayerDisposed -= OnPlayerDisposed;
|
||||
|
||||
});
|
||||
}
|
||||
@@ -121,7 +116,7 @@ namespace BITKit.Entities
|
||||
}
|
||||
|
||||
|
||||
if (client.IsConnected is false && server.IsRunningServer is false) return;
|
||||
if (client is {IsConnected:false} && server is {IsRunningServer:false}) return;
|
||||
using var memoryStream = new MemoryStream();
|
||||
if (client is {IsConnected:true}&& _playerEntity as Entity && _playerHeader != null)
|
||||
{
|
||||
|
Reference in New Issue
Block a user