lab3 some minor fixes
This commit is contained in:
parent
957775120d
commit
766efc216d
@ -12,15 +12,15 @@ public class HardGeneric<T extends EntityShip, U extends IDrawBlocks>{
|
||||
U[] blocks;
|
||||
private int shipsNumber;
|
||||
private int blocksNumber;
|
||||
private final int pictureBoxWidth;
|
||||
private final int pictureBoxHeight;
|
||||
private final int PICTURE_WIDTH;
|
||||
private final int PICTURE_HEIGHT;
|
||||
public HardGeneric(int shipsCount, int blocksCount, int width, int height){
|
||||
shipsNumber = 0;
|
||||
blocksNumber = 0;
|
||||
ships = (T[]) new EntityShip[shipsCount];
|
||||
blocks = (U[]) new IDrawBlocks[blocksCount];
|
||||
pictureBoxHeight = height;
|
||||
pictureBoxWidth = width;
|
||||
PICTURE_HEIGHT = height;
|
||||
PICTURE_WIDTH = width;
|
||||
}
|
||||
public boolean insertShip(T entityShip){
|
||||
if(ships[ships.length-1] != null)
|
||||
@ -48,8 +48,8 @@ public class HardGeneric<T extends EntityShip, U extends IDrawBlocks>{
|
||||
IDrawBlocks block = blocks[rand.nextInt(0, blocksNumber)];
|
||||
if (entity instanceof EntityBattleship)
|
||||
return new DrawingBattleship(entity.getSpeed(), entity.getWeight(), entity.getBodyColor(), ((EntityBattleship) entity).getAdditionalColor(),
|
||||
((EntityBattleship) entity).getTurret(), ((EntityBattleship) entity).getRocketLauncher(), pictureBoxWidth, pictureBoxHeight, block.getType(), block.getNumber());
|
||||
return new DrawingShip(entity.getSpeed(), entity.getWeight(), entity.getBodyColor(), pictureBoxWidth, pictureBoxHeight, block.getType(), block.getNumber());
|
||||
((EntityBattleship) entity).getTurret(), ((EntityBattleship) entity).getRocketLauncher(), PICTURE_WIDTH, PICTURE_HEIGHT, block.getType(), block.getNumber());
|
||||
return new DrawingShip(entity.getSpeed(), entity.getWeight(), entity.getBodyColor(), PICTURE_WIDTH, PICTURE_HEIGHT, block.getType(), block.getNumber());
|
||||
}
|
||||
public EntityShip makeRandomShip(){
|
||||
Random random = new Random();
|
||||
|
Loading…
Reference in New Issue
Block a user