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 Offset <DesiredGameInfoState> ToFlatBuffer(FlatBufferBuilder builder) { DesiredGameInfoState.StartDesiredGameInfoState(builder); if (GameSpeed.HasValue) { DesiredGameInfoState.AddGameSpeed(builder, Float.CreateFloat(builder, GameSpeed.Value)); } if (WorldGravityZ.HasValue) { DesiredGameInfoState.AddWorldGravityZ(builder, Float.CreateFloat(builder, WorldGravityZ.Value)); } if (Paused.HasValue) { DesiredGameInfoState.AddPaused(builder, Bool.CreateBool(builder, Paused.Value)); } if (EndMatch.HasValue) { DesiredGameInfoState.AddEndMatch(builder, Bool.CreateBool(builder, EndMatch.Value)); } return(DesiredGameInfoState.EndDesiredGameInfoState(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)); }