Exemplo n.º 1
0
        protected override void OnCreate()
        {
            RequireSingletonForUpdate <NetworkSnapshotAckComponent>();
            RequireSingletonForUpdate <GhostPrefabCollectionComponent>();

            _ghostCollectionSystem = World.GetOrCreateSystem <GhostCollectionSystem>();
            _delayedSpawnQueue     = new NativeQueue <DelayedSpawnGhost>(Allocator.Persistent);
            _ghostRecvSystem       = World.GetOrCreateSystem <GhostReceiveSystem>();
            _networkTimeSystem     = World.GetOrCreateSystem <NetworkTimeSystem>();
        }
        protected override void OnCreate()
        {
            _ghostCollectionSystem = World.GetOrCreateSystem <GhostCollectionSystem>();
            var ent = EntityManager.CreateEntity();

            EntityManager.AddComponentData(ent, default(GhostSpawnQueueComponent));
            EntityManager.AddBuffer <GhostSpawnBuffer>(ent);
            EntityManager.AddBuffer <SnapshotDataBuffer>(ent);
            RequireSingletonForUpdate <NetworkIdComponent>();
        }
        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>();
        }