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

52 lines
2.1 KiB
Java

import java.awt.*;
public class DrawningTriangleEngines implements IDrawningEngines{
private DirectionEnginesOnStormtrooper enginesCount;
@Override
public void Draw(Graphics g, int x, int y, Color bodyColor) {
g.setColor(bodyColor);
switch (enginesCount) {
case TWO:
g.fillPolygon(new int[]{x + 50,x+60,x+60}, new int[]{y+5,y, y +10 }, 3);
g.fillPolygon(new int[]{x + 50,x+60,x+60}, new int[]{y+95,y+90, y +100 }, 3);
break;
case FOUR:
g.fillPolygon(new int[]{x + 50,x+60,x+60}, new int[]{y+5,y, y +10 }, 3);
g.fillPolygon(new int[]{x + 50,x+60,x+60}, new int[]{y+20,y+15, y +25 }, 3);
g.fillPolygon(new int[]{x + 50,x+60,x+60}, new int[]{y+80,y+75, y +85 }, 3);
g.fillPolygon(new int[]{x + 50,x+60,x+60}, new int[]{y+95,y+90, y +100 }, 3);
break;
case SIX:
g.fillPolygon(new int[]{x + 50,x+60,x+60}, new int[]{y+5,y, y +10 }, 3);
g.fillPolygon(new int[]{x + 50,x+60,x+60}, new int[]{y+20,y+15, y +25 }, 3);
g.fillPolygon(new int[]{x + 50,x+60,x+60}, new int[]{y+35,y+30, y +40 }, 3);
g.fillPolygon(new int[]{x + 50,x+60,x+60}, new int[]{y+65,y+60, y +70 }, 3);
g.fillPolygon(new int[]{x + 50,x+60,x+60}, new int[]{y+80,y+75, y +85 }, 3);
g.fillPolygon(new int[]{x + 50,x+60,x+60}, new int[]{y+95,y+90, y +100 }, 3);
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;
}
}
public DrawningTriangleEngines(int count){
SetNewEngines(count);
}
}