diff --git a/ProjectStormtrooper/ExtensionDrawingPlane.java b/ProjectStormtrooper/ExtensionDrawingPlane.java new file mode 100644 index 0000000..c1d21ce --- /dev/null +++ b/ProjectStormtrooper/ExtensionDrawingPlane.java @@ -0,0 +1,31 @@ +package ProjectStormtrooper; + +import java.awt.*; + +public class ExtensionDrawingPlane { + public static DrawingPlane CreateDrawingPlane(String info, String separatorForObject, int width, int height) { + String[] strs = info.split(separatorForObject); + if (strs.length == 3) + { + return new DrawingPlane( + Integer.parseInt(strs[0]), + Integer.parseInt(strs[1]), + Color.getColor(strs[2]), + width, height + ); + } + if (strs.length == 6) + { + return new DrawingStormtrooper( + Integer.parseInt(strs[0]), + Integer.parseInt(strs[1]), + Color.getColor(strs[2]), + Color.getColor(strs[3]), + Boolean.parseBoolean(strs[4]), + Boolean.parseBoolean(strs[5]), + width, height + ); + } + return null; + } +}