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>(); }
public void Setup() { // This is the minimal set required for subscriptions to work. var mockConnectionBuilder = new MockConnectionHandlerBuilder(); WorkerInWorld = WorkerInWorld.CreateWorkerInWorldAsync(mockConnectionBuilder, "TestWorkerType", new TestLogDispatcher(), Vector3.zero).Result; World = WorkerInWorld.World; Worker = World.GetExistingSystem <WorkerSystem>(); SubscriptionSystem = World.GetExistingSystem <SubscriptionSystem>(); LogDispatcher = Worker.LogDispatcher; }
public void OneTimeSetup() { var mockConnectionBuilder = new MockConnectionHandlerBuilder(); worker = WorkerInWorld.CreateWorkerInWorldAsync(mockConnectionBuilder, "TestWorkerType", new TestLogDispatcher(), Vector3.zero).Result; var world = worker.World; sendSystem = world.GetExistingSystem <ComponentSendSystem>(); var testHandler = new TestComponentReplicationHandler(); sendSystem.AddComponentReplicator(testHandler); }
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); }
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 static MockWorld Create(Options options) { var mockWorld = new MockWorld(); var connectionBuilder = new MockConnectionHandlerBuilder(); mockWorld.Connection = connectionBuilder.ConnectionHandler; mockWorld.Worker = WorkerInWorld .CreateWorkerInWorldAsync(connectionBuilder, options.WorkerType ?? "TestWorkerType", options.Logger ?? new LoggingDispatcher(), Vector3.zero) .Result; options.AdditionalSystems?.Invoke(mockWorld.Worker.World); mockWorld.Linker = new EntityGameObjectLinker(mockWorld.Worker.World); PlayerLoopUtils.ResolveSystemGroups(mockWorld.Worker.World); return(mockWorld); }