Beispiel #1
0
        public async Task TestA()
        {
            var(c, s) = await Start();

            EntityUid dummyUid = default;

            s.Post(() =>
            {
                var pos       = new MapCoordinates(Vector2.Zero, new MapId(1));
                var ent       = IoCManager.Resolve <IEntityManager>();
                var container = ent.SpawnEntity("ContainerOcclusionA", pos);
                var dummy     = ent.SpawnEntity("ContainerOcclusionDummy", pos);
                dummyUid      = dummy.Uid;

                container.GetComponent <EntityStorageComponent>().Insert(dummy);
            });

            await RunTicksSync(c, s, 5);

            c.Assert(() =>
            {
                var dummy  = IoCManager.Resolve <IEntityManager>().GetEntity(dummyUid);
                var sprite = dummy.GetComponent <SpriteComponent>();
                var light  = dummy.GetComponent <PointLightComponent>();
                Assert.True(sprite.ContainerOccluded);
                Assert.True(light.ContainerOccluded);
            });

            await Task.WhenAll(c.WaitIdleAsync(), s.WaitIdleAsync());
        }
Beispiel #2
0
        private static async Task ConnectNetworking(ClientIntegrationInstance client, ServerIntegrationInstance server)
        {
            await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync());

            // Connect.

            client.SetConnectTarget(server);

            client.Post(() => IoCManager.Resolve <IClientNetManager>().ClientConnect(null, 0, null));

            // Run some ticks for the handshake to complete and such.

            for (var i = 0; i < 10; i++)
            {
                server.RunTicks(1);
                await server.WaitIdleAsync();

                client.RunTicks(1);
                await client.WaitIdleAsync();
            }

            await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync());
        }