Work is done 02
This commit is contained in:
parent
1ef0f5465b
commit
fb4c5f3416
@ -16,7 +16,7 @@ public class DrawingArtillery {
|
|||||||
|
|
||||||
public DrawingArtillery(int speed, float weight, Color bodyColor, int rollersCount) {
|
public DrawingArtillery(int speed, float weight, Color bodyColor, int rollersCount) {
|
||||||
artillery = new EntityArtillery(speed, weight, bodyColor);
|
artillery = new EntityArtillery(speed, weight, bodyColor);
|
||||||
drawingRollers = new DrawingRollers(rollersCount, bodyColor);
|
drawingRollers = RollersType.random(rollersCount, bodyColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DrawingArtillery(int speed, float weight, Color bodyColor, int rollersCount, int artilleryWidth, int artilleryHeight) {
|
protected DrawingArtillery(int speed, float weight, Color bodyColor, int rollersCount, int artilleryWidth, int artilleryHeight) {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.geom.Line2D;
|
|
||||||
|
|
||||||
public class DrawingCrossRollers implements IDrawingRollers {
|
public class DrawingCrossRollers implements IDrawingRollers {
|
||||||
private RollersCount rollersCount;
|
private RollersCount rollersCount;
|
||||||
|
17
RollersType.java
Normal file
17
RollersType.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import java.awt.*;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public enum RollersType {
|
||||||
|
Standard,
|
||||||
|
Squared,
|
||||||
|
Cross;
|
||||||
|
|
||||||
|
public static IDrawingRollers random(int rollersCount, Color bodyColor) {
|
||||||
|
return switch (new Random().nextInt(RollersType.values().length)) {
|
||||||
|
case 0 -> new DrawingRollers(rollersCount, bodyColor);
|
||||||
|
case 1 -> new DrawingSquaredRollers(rollersCount, bodyColor);
|
||||||
|
case 2 -> new DrawingCrossRollers(rollersCount, bodyColor);
|
||||||
|
default -> null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user