Add dispose() to Entity and implement in Brick
This commit is contained in:
parent
e116f1064d
commit
9df81ee854
@ -27,6 +27,7 @@ public class Brick extends Entity implements PhysicsBody, CollisionListener {
|
||||
public static final float BRICK_HEIGHT = 2.5f;
|
||||
|
||||
private static final EarClippingTriangulator ECT = new EarClippingTriangulator();
|
||||
private static final Vector2 tmp = new Vector2();
|
||||
|
||||
private BrickType type;
|
||||
private BrickShape shape;
|
||||
@ -40,8 +41,6 @@ public class Brick extends Entity implements PhysicsBody, CollisionListener {
|
||||
private Body body;
|
||||
private boolean hitByBall = false;
|
||||
|
||||
private final Vector2 tmp = new Vector2();
|
||||
|
||||
public Brick(PlayState state, PowerUpType powerUpType, float x, float y) {
|
||||
this(state, powerUpType, true, x, y);
|
||||
}
|
||||
@ -209,6 +208,12 @@ public class Brick extends Entity implements PhysicsBody, CollisionListener {
|
||||
public void endContact(Entity contacted) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
solid.dispose();
|
||||
pm.dispose();
|
||||
}
|
||||
|
||||
public boolean hit() {
|
||||
if (state.bricks.size-1 <= Ball.BLOCKS_FOR_BOOST) {
|
||||
for (Ball ball : state.balls) {
|
||||
|
@ -23,6 +23,8 @@ public abstract class Entity {
|
||||
|
||||
public abstract void update(float dt);
|
||||
|
||||
public void dispose() {}
|
||||
|
||||
public Vector2 getPos() {
|
||||
return pos;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user