public static Movement.GenericMovement MovementFromStruct(Movement.MovementStruct movementStruct) { Movement.GenericMovement result = null; if (movementStruct.Bearing == Movement.ManeuverBearing.Straight) { result = new Movement.StraightMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.KoiogranTurn) { result = new Movement.KoiogranTurnMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.Turn) { result = new Movement.TurnMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.Bank) { result = new Movement.BankMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.SegnorsLoop) { result = new Movement.SegnorsLoopMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.TallonRoll) { result = new Movement.TallonRollMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.Stationary) { result = new Movement.StationaryMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } return(result); }
public static Movement.GenericMovement MovementFromStruct(Movement.ManeuverHolder movementStruct) { Movement.GenericMovement result = null; if (movementStruct.Bearing == Movement.ManeuverBearing.Straight) { result = new Movement.StraightMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.KoiogranTurn) { result = new Movement.KoiogranTurnMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.Turn) { result = new Movement.TurnMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.Bank) { result = new Movement.BankMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.SegnorsLoop) { result = new Movement.SegnorsLoopMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.SegnorsLoopUsingTurnTemplate) { result = new Movement.SegnorsLoopUsingTurnTemplateMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.TallonRoll) { result = new Movement.TallonRollMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.Stationary) { result = new Movement.StationaryMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else if (movementStruct.Bearing == Movement.ManeuverBearing.Reverse) { if (movementStruct.Direction == Movement.ManeuverDirection.Forward) { result = new Movement.ReverseStraightMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } else { result = new Movement.ReverseBankMovement(movementStruct.SpeedInt, movementStruct.Direction, movementStruct.Bearing, movementStruct.ColorComplexity); } } return(result); }