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;
|
U[] blocks;
|
||||||
private int shipsNumber;
|
private int shipsNumber;
|
||||||
private int blocksNumber;
|
private int blocksNumber;
|
||||||
private final int pictureBoxWidth;
|
private final int PICTURE_WIDTH;
|
||||||
private final int pictureBoxHeight;
|
private final int PICTURE_HEIGHT;
|
||||||
public HardGeneric(int shipsCount, int blocksCount, int width, int height){
|
public HardGeneric(int shipsCount, int blocksCount, int width, int height){
|
||||||
shipsNumber = 0;
|
shipsNumber = 0;
|
||||||
blocksNumber = 0;
|
blocksNumber = 0;
|
||||||
ships = (T[]) new EntityShip[shipsCount];
|
ships = (T[]) new EntityShip[shipsCount];
|
||||||
blocks = (U[]) new IDrawBlocks[blocksCount];
|
blocks = (U[]) new IDrawBlocks[blocksCount];
|
||||||
pictureBoxHeight = height;
|
PICTURE_HEIGHT = height;
|
||||||
pictureBoxWidth = width;
|
PICTURE_WIDTH = width;
|
||||||
}
|
}
|
||||||
public boolean insertShip(T entityShip){
|
public boolean insertShip(T entityShip){
|
||||||
if(ships[ships.length-1] != null)
|
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)];
|
IDrawBlocks block = blocks[rand.nextInt(0, blocksNumber)];
|
||||||
if (entity instanceof EntityBattleship)
|
if (entity instanceof EntityBattleship)
|
||||||
return new DrawingBattleship(entity.getSpeed(), entity.getWeight(), entity.getBodyColor(), ((EntityBattleship) entity).getAdditionalColor(),
|
return new DrawingBattleship(entity.getSpeed(), entity.getWeight(), entity.getBodyColor(), ((EntityBattleship) entity).getAdditionalColor(),
|
||||||
((EntityBattleship) entity).getTurret(), ((EntityBattleship) entity).getRocketLauncher(), 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(), pictureBoxWidth, pictureBoxHeight, block.getType(), block.getNumber());
|
return new DrawingShip(entity.getSpeed(), entity.getWeight(), entity.getBodyColor(), PICTURE_WIDTH, PICTURE_HEIGHT, block.getType(), block.getNumber());
|
||||||
}
|
}
|
||||||
public EntityShip makeRandomShip(){
|
public EntityShip makeRandomShip(){
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user