protected override void OnCreate() { syncTypeCounts = new NativeArray <byte>((int)PerFrame.Max, Allocator.Persistent); syncTypeEnables = new NativeArray <bool>((int)PerFrame.Max, Allocator.Persistent); noneTypeEnables = new NativeArray <bool>(0, Allocator.Persistent); endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); actorCreateMessageQuery = GetEntityQuery(new EntityQueryDesc { All = new ComponentType[] { ComponentType.ReadOnly <OnCreateMessage>(), ComponentType.ReadOnly <Actor>(), ComponentType.ReadOnly <ActorOwner>(), ComponentType.ReadOnly <Translation>(), ComponentType.ReadOnly <ActorVisibleDistanceOnCD>(), }, }); actorSyncQuery = GetEntityQuery(new EntityQueryDesc { All = new ComponentType[] { ComponentType.ReadOnly <ActorVisibleDistanceOnSync>(), ComponentType.ReadOnly <Translation>(), }, None = new ComponentType[] { ComponentType.ReadOnly <OnDestroyMessage>(), }, }); }
protected void OnInit(Transform root) { // endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); // actorSpawnerMap = root.GetComponentInChildren <IActorSpawnerMap>(); Debug.Assert(actorSpawnerMap != null, $"actorSpawnerMap != null root={root}", root); // var startPointsT = root.Find(nameof(startPoints)); if (startPointsT == null) { Debug.LogError("startPointsT == null"); return; } startPoints = new Transform[startPointsT.childCount]; var i = 0; foreach (Transform c in startPointsT) { startPoints[i] = c; ++i; } }
protected override void OnCreate() { playerClientSystem = World.GetExistingSystem <PlayerClientSystem>(); endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); _actorEntityFromActorId = new NativeHashMap <int, Entity>(actorCountInHashMap, Allocator.Persistent); }
protected override void OnCreate() { endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); enterGameQuery = GetEntityQuery(new EntityQueryDesc { All = new ComponentType[] { ComponentType.ReadOnly <PlayerEnterGameMessage>() /*, ComponentType.ReadOnly<Player>()*/ }, None = new ComponentType[] { typeof(NetworkDisconnectedMessage) } }); }
protected void OnInit(Transform root) { // World.GetExistingSystem <NetworkStreamConnectSuccessSystem>().AddSystem(this); // endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); playerClientSystem = World.GetExistingSystem <PlayerClientSystem>(); }
protected override void OnCreate() { actorSyncCreateClientSystem = World.GetExistingSystem <ActorSyncCreateClientSystem>(); endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); networkConnectedMessageQuery = GetEntityQuery(new EntityQueryDesc { All = new ComponentType[] { ComponentType.ReadOnly <NetworkConnection>(), ComponentType.ReadOnly <NetworkConnectedMessage>() }, None = new ComponentType[] { ComponentType.ReadOnly <NetworkDisconnectedMessage>() }, }); }
protected override void OnCreate() { endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); #if ENABLE_UNITY_COLLECTIONS_CHECKS Debug.Assert(UnsafeUtility.SizeOf <NetworkInBuffer>() == 1); Debug.Assert(UnsafeUtility.SizeOf <NetworkReliableOutBuffer>() == 1); Debug.Assert(UnsafeUtility.SizeOf <NetworkUnreliableOutBuffer>() == 1); #endif init(); }
protected override void OnCreate() { endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); actorClientSystem = World.GetExistingSystem <ActorSyncCreateClientSystem>(); actorDestroyQuery = GetEntityQuery(new EntityQueryDesc { All = new ComponentType[] { ComponentType.ReadOnly <ActorId>(), ComponentType.ReadOnly <OnDestroyMessage>() }, }); clearActorQuery = GetEntityQuery(new EntityQueryDesc { All = new ComponentType[] { ComponentType.ReadOnly <Actor>() }, }); }
protected override void OnCreate() { endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); enterGameQuery = GetEntityQuery(new EntityQueryDesc { All = new ComponentType[] { ComponentType.ReadOnly <PlayerEnterGameMessage>(), ComponentType.ReadOnly <Player>() }, None = new ComponentType[] { typeof(NetworkDisconnectedMessage) } }); playerTeamChangeQuery = GetEntityQuery(new EntityQueryDesc { All = new ComponentType[] { ComponentType.ReadOnly <NetworkConnection>(), ComponentType.ReadOnly <PlayerTeamChangeNetMessage>() },//可以没有Player时修改PlayerTeam None = new ComponentType[] { typeof(NetworkDisconnectedMessage) } }); }
protected override void OnCreate() { endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); enterGameQuery = GetEntityQuery(new EntityQueryDesc { All = new ComponentType[] { ComponentType.ReadOnly <PlayerEnterGameMessage>(), ComponentType.ReadOnly <NetworkId>() }, None = new ComponentType[] { typeof(NetworkDisconnectedMessage) } }); quitGameQuery = GetEntityQuery(new EntityQueryDesc { All = new ComponentType[] { ComponentType.ReadOnly <Player>(), ComponentType.ReadOnly <NetworkDisconnectedMessage>() }, //Any = new ComponentType[] { ComponentType.ReadOnly<NetworkStreamDisconnectedMessage>() } }); //Player.id 就是Entity.Index, Player.id是不能为0的, 但是第一个创建的Entity的Index就是0(Entity.Version=1) //所以这里先创建一个 避免出现Player.id=0 var NullEntity = EntityManager.CreateEntity(); #if UNITY_EDITOR EntityManager.SetName(NullEntity, "NullEntity"); #endif }
protected override void OnCreate() { endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); }
protected void OnInit(Transform root) { endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); Debug.Assert(endBarrier != null, "endBarrier != null"); }
protected void OnInit(Transform root) { endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); }
protected override void OnCreate() { networkStreamSystem = World.GetExistingSystem <NetworkStreamSystem>(); endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); }
protected void OnInit(Transform root) { endBarrier = World.GetExistingSystem <EndCommandBufferSystem>(); entityArchetype = EntityManager.CreateArchetype(typeof(ActorSpawnerData), typeof(ActorOwner), typeof(Translation), typeof(Rotation)); }