123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- package me.hammerle.supersnuvi.tiles;
- import me.hammerle.supersnuvi.entity.Entity;
- import me.hammerle.supersnuvi.util.CollisionObject;
- import me.hammerle.supersnuvi.util.Face;
- import me.hammerle.supersnuvi.gamelogic.Level;
- 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, Level l)
- {
- if(collisionBox != null)
- {
- return collisionBox;
- }
- return CollisionObject.NULL_BOX.reset();
- }
-
- public boolean shouldAiUseCollisionBox(int x, int y, Level l)
- {
- return true;
- }
-
- public CollisionObject getMovementBox(int x, int y, Level l)
- {
- if(movementCollision != null)
- {
- return movementCollision;
- }
- return CollisionObject.NULL_BOX.reset();
- }
-
- public void onEntityCollide(Entity ent, int x, int y, Face face, Level l)
- {
-
- }
-
- public void tick()
- {
- }
-
- public void reset(Level l)
- {
- }
-
- public void reset(int x, int y, Level l)
- {
- }
-
- public int getBottleScore()
- {
- return 0;
- }
-
- public float getTextureMinX(int x, int y, Level l)
- {
- return 0.0f;
- }
-
- public float getTextureMaxX(int x, int y, Level l)
- {
- return 0.0625f;
- }
-
- public float getTextureMinY(int x, int y, Level l)
- {
- return 0.0f;
- }
-
- public float getTextureMaxY(int x, int y, Level 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, Level l)
- {
- return true;
- }
- }
|