package fr.tchocolate.qbe.entities;
import org.lwjgl.util.vector.Vector3f;
import fr.tchocolate.qbe.world.Cube;
import fr.tchocolate.qbe.world.Map;
import fr.tchocolate.qbe.world.Material;
public abstract class Entity {
protected Vector3f position;
protected Vector3f tempPosition;
protected Vector3f rotation;
protected Map world;
protected int entityId;
protected boolean cLeft;
protected boolean cRight;
protected boolean cFront;
protected boolean cBack;
protected boolean jumping;
protected boolean falling;
public void update(){
calculateColisions();
move();
}
private void calculateColisions(){
Cube under = world.getCube(position.x, position.y-1, position.z);
if(under.getType() == Material.AIR && !jumping){
falling = true;
}else{
falling = false;
}
}
abstract void move();
public Vector3f getPosition() {
return position;
}
public void setPosition(Vector3f position) {
this.position = position;
}
public Vector3f getRotation() {
return rotation;
}
public void setRotation(Vector3f rotation) {
this.rotation = rotation;
}
public Map getWorld() {
return world;
}
public void setWorld(Map world) {
this.world = world;
}
public int getEntityId() {
return entityId;
}
public void setEntityId(int entityId) {
this.entityId = entityId;
}
public boolean isJumping() {
return jumping;
}
public void setJumping(boolean jumping) {
this.jumping = jumping;
}
public boolean isFalling() {
return falling;
}
public void setFalling(boolean falling) {
this.falling = falling;
}
}