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)); }
public static Offset <DesiredCarState> ToFlatBuffer(this Player player, FlatBufferBuilder builder) { DesiredCarState.StartDesiredCarState(builder); DesiredCarState.AddPhysics(builder, player.Physics.ToFlatBuffer(builder)); DesiredCarState.AddJumped(builder, Bool.CreateBool(builder, player.Jumped)); DesiredCarState.AddDoubleJumped(builder, Bool.CreateBool(builder, player.DoubleJumped)); DesiredCarState.AddBoostAmount(builder, Float.CreateFloat(builder, player.BoostAmount)); return(DesiredCarState.EndDesiredCarState(builder)); }