예제 #1
0
        public async Task SendControlInputAsync()
        {
            var builder = new FlatBufferBuilder(1);

            StringOffset customOffset = new StringOffset();

            if (CustomData != null)
            {
                customOffset = builder.CreateString(CustomData);
            }

            NetControlInput.StartNetControlInput(builder);

            NetControlInput.AddAngle(builder, 0);
            NetControlInput.AddBoost(builder, ControlIsBoosting);
            NetControlInput.AddX(builder, ControlAimTarget.X);
            NetControlInput.AddY(builder, ControlAimTarget.Y);
            NetControlInput.AddShoot(builder, ControlIsShooting);
            if (CustomData != null)
            {
                NetControlInput.AddCustomData(builder, customOffset);
            }

            var controlInput = NetControlInput.EndNetControlInput(builder);

            var q = NetQuantum.CreateNetQuantum(builder, AllMessages.NetControlInput, controlInput.Value);

            builder.Finish(q.Value);

            await SendAsync(builder.DataBuffer, default(CancellationToken));
        }
예제 #2
0
        public async Task SendControlInputAsync()
        {
            var builder = new FlatBufferBuilder(1);

            NetControlInput.StartNetControlInput(builder);

            NetControlInput.AddAngle(builder, 0);
            NetControlInput.AddBoost(builder, ControlIsBoosting);
            NetControlInput.AddX(builder, ControlAimTarget.X);
            NetControlInput.AddY(builder, ControlAimTarget.Y);
            NetControlInput.AddShoot(builder, ControlIsShooting);

            var controlInput = NetControlInput.EndNetControlInput(builder);

            var q = NetQuantum.CreateNetQuantum(builder, AllMessages.NetControlInput, controlInput.Value);

            builder.Finish(q.Value);

            await SendAsync(builder.DataBuffer, default(CancellationToken));
        }