示例#1
0
文件: CarState.cs 项目: Dadle/RLBot
        public Offset <DesiredCarState> ToFlatBuffer(FlatBufferBuilder builder)
        {
            int physicsStateOffset = PhysicsState == null ? -1 : PhysicsState.ToFlatBuffer(builder).Value;

            DesiredCarState.StartDesiredCarState(builder);

            if (PhysicsState != null)
            {
                DesiredCarState.AddPhysics(builder, new Offset <DesiredPhysics>(physicsStateOffset));
            }

            if (Jumped.HasValue)
            {
                DesiredCarState.AddJumped(builder, Bool.CreateBool(builder, Jumped.Value));
            }

            if (DoubleJumped.HasValue)
            {
                DesiredCarState.AddDoubleJumped(builder, Bool.CreateBool(builder, DoubleJumped.Value));
            }

            if (Boost.HasValue)
            {
                DesiredCarState.AddBoostAmount(builder, Float.CreateFloat(builder, Boost.Value));
            }

            return(DesiredCarState.EndDesiredCarState(builder));
        }
示例#2
0
文件: BallState.cs 项目: Dadle/RLBot
        public Offset <DesiredBallState> ToFlatBuffer(FlatBufferBuilder builder)
        {
            int physicsStateOffset = PhysicsState == null ? -1 : PhysicsState.ToFlatBuffer(builder).Value;

            DesiredBallState.StartDesiredBallState(builder);

            if (PhysicsState != null)
            {
                DesiredBallState.AddPhysics(builder, new Offset <DesiredPhysics>(physicsStateOffset));
            }

            return(DesiredBallState.EndDesiredBallState(builder));
        }