Пример #1
0
        protected override void OnCreate()
        {
            serializers  = default(TGhostSerializerCollection);
            m_DataStream = new DataStreamWriter(2048, Allocator.Persistent);
            ghostGroup   = GetEntityQuery(typeof(GhostComponent), typeof(GhostSystemStateComponent));
            EntityQueryDesc filterSpawn = new EntityQueryDesc
            {
                All  = new ComponentType[] { typeof(GhostComponent) },
                None = new ComponentType[] { typeof(GhostSystemStateComponent) }
            };
            EntityQueryDesc filterDespawn = new EntityQueryDesc
            {
                All  = new ComponentType[] { typeof(GhostSystemStateComponent) },
                None = new ComponentType[] { typeof(GhostComponent) }
            };

            ghostSpawnGroup   = GetEntityQuery(filterSpawn);
            ghostDespawnGroup = GetEntityQuery(filterDespawn);

            m_FreeGhostIds         = new NativeQueue <int>(Allocator.Persistent);
            m_AllocatedGhostIds    = new NativeArray <int>(1, Allocator.Persistent);
            m_AllocatedGhostIds[0] = 1; // To make sure 0 is invalid

            connectionGroup = GetEntityQuery(
                ComponentType.ReadWrite <NetworkStreamConnection>(),
                ComponentType.ReadOnly <NetworkStreamInGame>());

            m_ServerSimulation = World.GetExistingSystem <ServerSimulationSystemGroup>();
            m_Barrier          = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>();
            m_ReceiveSystem    = World.GetOrCreateSystem <NetworkStreamReceiveSystem>();

            m_ConnectionStates      = new List <ConnectionStateData>(256);
            m_ConnectionStateLookup = new NativeHashMap <Entity, int>(256, Allocator.Persistent);
            m_CompressionModel      = new NetworkCompressionModel(Allocator.Persistent);

            m_SerialSpawnChunks = new NativeList <PrioChunk>(1024, Allocator.Persistent);
        }
Пример #2
0
 protected override void OnCreate()
 {
     m_ReceiveSystem = World.GetOrCreateSystem <NetworkStreamReceiveSystem>();
     m_TimeSystem    = World.GetOrCreateSystem <NetworkTimeSystem>();
 }