46 lines
875 B
Java
46 lines
875 B
Java
package simulation;
|
|
|
|
import java.util.Optional;
|
|
|
|
public abstract class Building {
|
|
protected final int id;
|
|
protected final String type;
|
|
protected final int x;
|
|
protected final int y;
|
|
protected BuildingState state = BuildingState.EMPTY;
|
|
|
|
protected Building(int id, String type, int x, int y) {
|
|
this.id = id;
|
|
this.type = type;
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
public abstract void processInput(Component input);
|
|
public abstract Optional<Component> update();
|
|
|
|
public int getId() {
|
|
return id;
|
|
}
|
|
|
|
public String getType() {
|
|
return type;
|
|
}
|
|
|
|
public int getX() {
|
|
return x;
|
|
}
|
|
|
|
public int getY() {
|
|
return y;
|
|
}
|
|
|
|
public BuildingState getState() {
|
|
return state;
|
|
}
|
|
|
|
public void setState(BuildingState state) {
|
|
this.state = state;
|
|
}
|
|
}
|