public void OneTimeSetup()
        {
            world         = new World("test-world");
            entityManager = world.GetOrCreateManager <EntityManager>();
            logDispatcher = new TestLogDispatcher();

            worker = world.CreateManager <WorkerSystem>(null, logDispatcher, TestWorkerType, Vector3.zero);

            firstComponentDispatcher  = new FirstComponentDispatcher(worker, world);
            secondComponentDispatcher = new SecondComponentDispatcher(worker, world);

            receiveSystem = world.GetOrCreateManager <SpatialOSReceiveSystem>();

            // Do not add command components from any generated code.
            receiveSystem.AddAllCommandComponents.Clear();
            receiveSystem.AddDispatcherHandler(firstComponentDispatcher);
            receiveSystem.AddDispatcherHandler(secondComponentDispatcher);

            var requestTracker = world.GetOrCreateManager <CommandRequestTrackerSystem>();

            createEntityStorage     = requestTracker.GetCommandStorageForType <WorldCommands.CreateEntity.Storage>();
            deleteEntityStorage     = requestTracker.GetCommandStorageForType <WorldCommands.DeleteEntity.Storage>();
            reserveEntityIdsStorage = requestTracker.GetCommandStorageForType <WorldCommands.ReserveEntityIds.Storage>();
            entityQueryStorage      = requestTracker.GetCommandStorageForType <WorldCommands.EntityQuery.Storage>();
        }
Exemple #2
0
        public void Setup()
        {
            var builder = new MockConnectionHandlerBuilder();

            connectionHandler = builder.ConnectionHandler;

            worker = WorkerInWorld.CreateWorkerInWorldAsync(builder, "TestWorkerType", new LoggingDispatcher(),
                                                            Vector3.zero).Result;

            receiveSystem = worker.World.GetExistingSystem <SpatialOSReceiveSystem>();
        }
Exemple #3
0
        public virtual void Setup()
        {
            var connectionBuilder = new MockConnectionHandlerBuilder();

            ConnectionHandler = connectionBuilder.ConnectionHandler;

            WorkerInWorld = WorkerInWorld
                            .CreateWorkerInWorldAsync(connectionBuilder, "TestWorkerType", new LoggingDispatcher(), Vector3.zero)
                            .Result;

            var world = WorkerInWorld.World;

            ReceiveSystem          = world.GetExistingSystem <SpatialOSReceiveSystem>();
            RequireLifecycleSystem = world.GetExistingSystem <RequireLifecycleSystem>();
            Linker = new EntityGameObjectLinker(world);
        }
Exemple #4
0
        public void Setup()
        {
            var logDispatcher = new LoggingDispatcher();

            var connectionBuilder = new MockConnectionHandlerBuilder();

            connectionHandler = connectionBuilder.ConnectionHandler;
            workerInWorld     = WorkerInWorld
                                .CreateWorkerInWorldAsync(connectionBuilder, WorkerType, logDispatcher, Vector3.zero)
                                .Result;
            receiveSystem          = workerInWorld.World.GetExistingSystem <SpatialOSReceiveSystem>();
            requireLifecycleSystem = workerInWorld.World.GetExistingSystem <RequireLifecycleSystem>();

            var goInitSystem = workerInWorld.World
                               .CreateSystem <GameObjectInitializationSystem>(
                new GameObjectCreatorFromMetadata(WorkerType, Vector3.zero, logDispatcher), null);

            linker = goInitSystem.Linker;
        }
        public void Setup()
        {
            var connectionBuilder = new MockConnectionHandlerBuilder();

            connectionHandler = connectionBuilder.ConnectionHandler;

            workerInWorld = WorkerInWorld
                            .CreateWorkerInWorldAsync(connectionBuilder, "TestWorkerType", new LoggingDispatcher(), Vector3.zero)
                            .Result;

            var world = workerInWorld.World;

            receiveSystem          = world.GetExistingSystem <SpatialOSReceiveSystem>();
            requireLifecycleSystem = world.GetExistingSystem <RequireLifecycleSystem>();
            linker = new EntityGameObjectLinker(world);

            var template = new EntityTemplate();

            template.AddComponent(new Position.Snapshot(), "worker");
            connectionHandler.CreateEntity(EntityId, template);
            receiveSystem.Update();
        }
        public void Setup()
        {
            world             = new World("TestWorld");
            connectionHandler = new MockConnectionHandler();
            world.CreateManager <WorkerSystem>(connectionHandler, null,
                                               new LoggingDispatcher(), "TestWorkerType", Vector3.zero);
            receiveSystem = world.CreateManager <SpatialOSReceiveSystem>();
            world.GetOrCreateManager <ComponentUpdateSystem>();
            world.GetOrCreateManager <ComponentConstraintsCallbackSystem>();
            world.CreateManager <SubscriptionSystem>();
            world.CreateManager <CommandCallbackSystem>();
            world.CreateManager <ComponentCallbackSystem>();
            requireLifecycleSystem = world.CreateManager <RequireLifecycleSystem>();

            linker = new EntityGameObjectLinker(world);

            var template = new EntityTemplate();

            template.AddComponent(new Position.Snapshot(), "worker");
            connectionHandler.CreateEntity(EntityId, template);
            receiveSystem.Update();
        }