protected override void OnCreate()
        {
            var ent = EntityManager.CreateEntity();

            EntityManager.AddComponentData(ent, default(PredictedGhostSpawnList));
            EntityManager.AddBuffer <PredictedGhostSpawn>(ent);

            RequireSingletonForUpdate <PredictedGhostSpawnList>();

            _ghostInitQuery = GetEntityQuery(ComponentType.ReadOnly <PredictedGhostSpawnRequestComponent>(),
                                             ComponentType.ReadWrite <GhostComponent>());
            _ghostQuery = GetEntityQuery(ComponentType.ReadWrite <GhostComponent>(),
                                         ComponentType.ReadOnly <PredictedGhostSpawnPendingComponent>());

            _barrier                    = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>();
            _networkTimeSystem          = World.GetOrCreateSystem <NetworkTimeSystem>();
            _ghostCollectionSystem      = World.GetOrCreateSystem <GhostCollectionSystem>();
            _ghostPredictionSystemGroup = World.GetOrCreateSystem <GhostPredictionSystemGroup>();
        }
Example #2
0
        protected override void OnCreate()
        {
            _connectionStates = new UnsafeHashMap <Entity, ConnectionStateData>(128, Allocator.Persistent);
            _newGhosts        = new NativeHashMap <int, Entity>(16, Allocator.Persistent);

            _ghostPredictionSystemGroup =
                World.GetExistingSystem <GhostPredictionSystemGroup>();

            NetworkStreamReceiveSystem networkStreamReceiveSystem =
                World.GetExistingSystem <NetworkStreamReceiveSystem>();

            _driver             = networkStreamReceiveSystem.Driver;
            _compressionModel   = new NetworkCompressionModel(Allocator.Persistent);
            _unreliablePipeline = networkStreamReceiveSystem.UnreliablePipeline;

            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);
            ghostGroup        = GetEntityQuery(ComponentType.ReadOnly <GhostComponent>(),
                                               ComponentType.ReadOnly <GhostSystemStateComponent>());

            connectionGroup = GetEntityQuery(ComponentType.ReadWrite <NetworkStreamConnection>(),
                                             ComponentType.ReadOnly <NetworkStreamInGame>(),
                                             ComponentType.Exclude <NetworkStreamDisconnected>());
        }
Example #3
0
 protected override void OnCreate()
 {
     _ghostPredictionSystemGroup = World.GetOrCreateSystem <GhostPredictionSystemGroup>();
 }