-Added a link to the team that owns a building
-Added method for drones to find the owner of a building -Buildings now distinguished between public and private Signed-off-by: Tony Grosinger <tony@grosinger.net>
This commit is contained in:
parent
c1f49275fe
commit
73cd872900
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -16,6 +16,7 @@ package net.grosinger.nomads;
|
||||
public class Building implements GameObject {
|
||||
Structure structure;
|
||||
String name;
|
||||
DroneTeam team;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
@ -25,7 +26,7 @@ public class Building implements GameObject {
|
||||
TOWNHALL, REPAIRSHOP, UPGRADESHOP, POLICESTATION, HOUSE
|
||||
}
|
||||
|
||||
public Building(Structure thisBuilding, int newX, int newY) {
|
||||
public Building(Structure thisBuilding, int newX, int newY, DroneTeam team) {
|
||||
structure = thisBuilding;
|
||||
switch (structure) {
|
||||
case TOWNHALL: {
|
||||
@ -50,6 +51,7 @@ public class Building implements GameObject {
|
||||
}
|
||||
}
|
||||
|
||||
this.team = team;
|
||||
x = newX;
|
||||
y = newY;
|
||||
}
|
||||
@ -68,6 +70,20 @@ public class Building implements GameObject {
|
||||
return structure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the name of the team that owns the current building. If the
|
||||
* building is a public building, the string will be "Public".
|
||||
*
|
||||
* @return <code>String</code>
|
||||
*/
|
||||
public String getTeam() {
|
||||
if (structure == Structure.HOUSE) {
|
||||
return team.getName();
|
||||
} else {
|
||||
return "Public";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve x index
|
||||
*
|
||||
|
@ -62,6 +62,16 @@ public class NeighborBuilding implements GameObject {
|
||||
return building.getType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the name of the team that owns the current building. If the
|
||||
* building is a public building, the string will be "Public".
|
||||
*
|
||||
* @return <code>String</code>
|
||||
*/
|
||||
public String getTeam() {
|
||||
return building.getTeam();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String newName) {
|
||||
name = newName;
|
||||
|
Reference in New Issue
Block a user