protected override void OnCreate()
        {
            m_StatIndex = -1;

            m_ServerSimulationSystemGroup = World.GetExistingSystem <ServerSimulationSystemGroup>();
            m_ClientSimulationSystemGroup = World.GetExistingSystem <ClientSimulationSystemGroup>();
            if (m_ClientSimulationSystemGroup != null)
            {
                m_NetworkTimeSystem = World.GetOrCreateSystem <NetworkTimeSystem>();
            }
            m_SnapshotStats = new NativeArray <uint>(0, Allocator.Persistent);
            m_SnapshotTicks = new NativeList <uint>(16, Allocator.Persistent);
            m_TimeSamples   = new NativeList <TimeSample>(16, Allocator.Persistent);
            m_CommandTicks  = new NativeList <uint>(16, Allocator.Persistent);

            m_PacketQueue = new List <Packet>();
            m_PacketPool  = new List <byte[]>();
        }
Пример #2
0
        protected override void OnCreate()
        {
#if UNITY_EDITOR || DEVELOPMENT_BUILD
            m_GhostStatsCollectionSystem = World.GetOrCreateSystem <GhostStatsCollectionSystem>();
            m_NetStats = new NativeArray <uint>(2, Allocator.Persistent);
#endif
            serverSimulationSystemGroup = World.GetExistingSystem <ServerSimulationSystemGroup>();
            m_CompressionModel          = new NetworkCompressionModel(Allocator.Persistent);
            RequireForUpdate(EntityManager.CreateEntityQuery(
                                 ComponentType.ReadOnly <NetworkStreamInGame>(),
                                 ComponentType.ReadOnly <IncomingCommandDataStreamBufferComponent>(),
                                 ComponentType.ReadOnly <NetworkSnapshotAckComponent>(),
                                 ComponentType.ReadOnly <CommandTargetComponent>(),
                                 ComponentType.Exclude <NetworkStreamDisconnected>()));
            if (typeof(TCommandData) != typeof(NullCommandData))
            {
                RequireForUpdate(EntityManager.CreateEntityQuery(ComponentType.ReadWrite <TCommandData>()));
            }
        }
Пример #3
0
        protected override void OnCreate()
        {
            base.OnCreate();

            m_SerializeLookup = new Dictionary <Entity, ReferencableSerializeClientData>(32);
            m_ConnectionGroup = GetEntityQuery(new EntityQueryDesc
            {
                All = new ComponentType[] { typeof(NetworkStreamConnection), typeof(NetworkSnapshotAckComponent), /*typeof(NetworkStreamInGame)*/ }
            });
            m_ConnectionWithoutSnapshotBufferGroup = GetEntityQuery(new EntityQueryDesc
            {
                All  = new ComponentType[] { typeof(NetworkStreamConnection), /* typeof(NetworkStreamInGame)*/ },
                None = new ComponentType[] { typeof(ClientSnapshotBuffer) }
            });
            m_ServerSimulationSystemGroup = World.GetOrCreateSystem <ServerSimulationSystemGroup>();
            m_ReceiveSystem        = World.GetOrCreateSystem <NetworkStreamReceiveSystem>();
            m_CreateSnapshotSystem = World.GetOrCreateSystem <CreateSnapshotSystem>();

            m_DataStream = new DataStreamWriter(32_768, Allocator.Persistent);
        }