Added a queue size to the game hud and fixed the hud input thingy
This commit is contained in:
parent
bbf31af002
commit
5bb373573d
5 changed files with 125 additions and 46 deletions
|
|
@ -1,7 +1,6 @@
|
|||
package ei.game.scene.buildings;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
|
||||
import ei.engine.math.Vector2i;
|
||||
import ei.engine.scene.Node;
|
||||
|
|
@ -17,7 +16,7 @@ import ei.game.scene.units.Unit;
|
|||
*
|
||||
*/
|
||||
public abstract class Building extends GameEntity{
|
||||
private Queue<Unit> buildQueue;
|
||||
private LinkedList<Unit> buildQueue;
|
||||
private int buildTime;
|
||||
private Node unitNode;
|
||||
private Vector2i oldPos;
|
||||
|
|
@ -80,7 +79,41 @@ public abstract class Building extends GameEntity{
|
|||
InGameState.getMap().setBuildPos(this, x, y, size);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a unit to the build queue
|
||||
* @param u The unit to build
|
||||
*/
|
||||
public void buildUnit(Unit u){
|
||||
buildQueue.addLast(u);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the build queue
|
||||
* @return The size of the build queue
|
||||
*/
|
||||
public int getBuildQueueSize(){
|
||||
return buildQueue.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the last unit in the build queue
|
||||
*
|
||||
*/
|
||||
public void removeLast(){
|
||||
if(!buildQueue.isEmpty()){
|
||||
buildQueue.removeLast();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the procentage of completion of the unit
|
||||
*
|
||||
*/
|
||||
public int getBuildProgress(){
|
||||
// TODO return the procentage of completion of the unit
|
||||
return 50;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes this building from the game.
|
||||
*
|
||||
|
|
@ -98,8 +131,7 @@ public abstract class Building extends GameEntity{
|
|||
|
||||
if(getLife()<=0) {
|
||||
removeBuilding();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue