public void CreateRpcRequest_WithMultipleConnections_ShouldTargetThatConnection()
        {
            world.CreateSingleton <NetworkIdComponent>();
            Entity target = world.CreateSingleton <NetworkIdComponent>();

            world.CreateSingleton <NetworkIdComponent>();
            EntityQuery eq =
                world.EntityManager.CreateEntityQuery(typeof(TestRpc2), typeof(SendRpcCommandRequestComponent));

            CreateRpcRequestSystem.CreateRpcRequest(world, new TestRpc2 {
                Data = 42
            }, target);
            Assert.AreEqual(1, eq.CalculateEntityCount(), "Test should create entity first");
            Assert.IsFalse(target.Equals(system.CommandTargetComponentEntity),
                           "Target should not be return values of CommandTargetComponentEntity for this test");
            Assert.IsTrue(target.Equals(eq.GetSingleton <SendRpcCommandRequestComponent>().TargetConnection));
        }
Example #2
0
 public static Entity CreateRpcRequest <T>(this World world, T data, Entity targetConnection = default)
     where T : struct, IRpcCommand
 {
     return(CreateRpcRequestSystem.CreateRpcRequest(world, data, targetConnection));
 }
 public void CreateRpcRequest_WhenWorldIsNull_ShouldThrow()
 {
     Assert.Catch <ArgumentNullException>(() =>
                                          CreateRpcRequestSystem.CreateRpcRequest(null, new GoInGameRequest()));
 }
Example #4
0
 public static Entity CreateRpcRequest <T>(this EntityCommandBuffer.Concurrent buffer, int index, T data,
                                           Entity targetConnection)
     where T : struct, IRpcCommand
 {
     return(CreateRpcRequestSystem.CreateRpcRequest(buffer, index, data, targetConnection));
 }