package me.hammerle.supersnuvi.tiles; import me.hammerle.supersnuvi.entity.Entity; import me.hammerle.supersnuvi.gamelogic.ILevel; import me.hammerle.supersnuvi.util.CollisionObject; import me.hammerle.supersnuvi.util.Face; public abstract class Tile { public final static int SIZE = 32; public final static float SIZE_SCALE = SIZE / 32.0f; private CollisionObject movementCollision; private CollisionObject collisionBox; public Tile() { movementCollision = null; collisionBox = null; } /** Sets the collision box for movement * * @param cb a collision box * @return the tile which the change was applied to */ public Tile setMovementBox(CollisionObject cb) { if(cb == CollisionObject.NULL_BOX) { this.movementCollision = null; } else { this.movementCollision = cb.copy(); } return this; } /** Sets the collision box for normal collision * * @param cb a collision box * @return the tile which the change was applied to */ public Tile setCollisionBox(CollisionObject cb) { if(cb == CollisionObject.NULL_BOX) { this.collisionBox = null; } else { this.collisionBox = cb.copy(); } return this; } /** Sets the default collision box for movement and for collision * * @return the tile which the change was applied to */ public Tile setDefaultCollisionBox() { this.movementCollision = CollisionObject.DEFAULT_TILE_BOX.copy(); this.collisionBox = CollisionObject.DEFAULT_TILE_BOX.copy(); return this; } public CollisionObject getCollisionBox(int x, int y, ILevel l) { if(collisionBox != null) { return collisionBox; } return CollisionObject.NULL_BOX.reset(); } public boolean shouldAiUseCollisionBox(int x, int y, ILevel l) { return true; } public CollisionObject getMovementBox(int x, int y, ILevel l) { if(movementCollision != null) { return movementCollision; } return CollisionObject.NULL_BOX.reset(); } public void onEntityCollide(Entity ent, int x, int y, Face face, ILevel l) { } public void tick() { } public void reset(ILevel l) { } public void reset(int x, int y, ILevel l) { } public int getBottleScore() { return 0; } public float getTextureMinX(int x, int y, ILevel l) { return 0.0f; } public float getTextureMaxX(int x, int y, ILevel l) { return 0.0625f; } public float getTextureMinY(int x, int y, ILevel l) { return 0.0f; } public float getTextureMaxY(int x, int y, ILevel l) { return 0.0625f; } public float getOffsetX() { return 0.0f; } public float getOffsetY() { return 0.0f; } public float getWidth() { return Tile.SIZE; } public float getHeight() { return Tile.SIZE; } public boolean shouldRender(int x, int y, ILevel l) { return true; } }