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