PIbd-23_Kharlamov_A.A._Stor.../DrawingEngines.java

51 lines
1.7 KiB
Java

import java.awt.*;
public class DrawingEngines implements IDrawningEngines{
private DirectionEnginesOnStormtrooper enginesCount;
public DrawingEngines(int count) {
SetNewEngines(count);
}
@Override
public void Draw(Graphics g, int x, int y, Color bodycolor) {
g.setColor(bodycolor);
switch (enginesCount) {
case TWO:
g.fillRect(x + 50, y, 20, 5);
g.fillRect(x + 50, y+95, 20, 5);
break;
case FOUR:
g.fillRect(x + 50, y, 20, 5);
g.fillRect(x + 50, y+10, 20, 5);
g.fillRect(x + 50, y+85, 20, 5);
g.fillRect(x + 50, y+95, 20, 5);
break;
case SIX:
g.fillRect(x + 50, y, 20, 5);
g.fillRect(x + 50, y+10, 20, 5);
g.fillRect(x + 50, y+20, 20, 5);
g.fillRect(x + 50, y+75, 20, 5);
g.fillRect(x + 50, y+85, 20, 5);
g.fillRect(x + 50, y+95, 20, 5);
break;
}
}
@Override
public void SetNewEngines(int count) {
switch(count)
{
case 2:
enginesCount = DirectionEnginesOnStormtrooper.TWO;
break;
case 4:
enginesCount = DirectionEnginesOnStormtrooper.FOUR;
break;
case 6:
enginesCount = DirectionEnginesOnStormtrooper.SIX;
break;
default:
break;
}
}
}