use of org.openbw.bwapi4j.unit.Unit in project BWAPI4J by OpenBW.
the class MainTest method testMineralMining.
private void testMineralMining() throws AssertionError {
boolean commandSuccessful = false;
Player self = this.bw.getInteractionHandler().self();
Collection<Unit> allUnits = this.bw.getAllUnits();
MineralPatch patch = null;
for (Unit unit : allUnits) {
if (unit instanceof MineralPatch) {
patch = (MineralPatch) unit;
}
}
List<PlayerUnit> units = this.bw.getUnits(self);
SCV scv = null;
for (PlayerUnit unit : units) {
if (unit instanceof SCV) {
scv = (SCV) unit;
}
}
if (patch != null && scv != null) {
commandSuccessful = scv.gather(patch);
} else {
logger.error("no scv and patch found.");
}
assertTrue("gather command failed.", commandSuccessful);
}
use of org.openbw.bwapi4j.unit.Unit in project BWAPI4J by OpenBW.
the class BW method onUnitDestroy.
private void onUnitDestroy(int unitId) {
Unit unit = this.units.get(unitId);
if (unit == null) {
logger.error("onUnitDestroy: no unit found for ID {}.", unitId);
}
listener.onUnitDestroy(unit);
this.units.remove(unitId);
}
use of org.openbw.bwapi4j.unit.Unit in project BWAPI4J by OpenBW.
the class BW method onUnitShow.
private void onUnitShow(int unitId) {
Unit unit = this.units.get(unitId);
if (unit == null) {
logger.error("onUnitShow: no unit found for ID {}.", unitId);
}
listener.onUnitShow(unit);
}
use of org.openbw.bwapi4j.unit.Unit in project BWAPI4J by OpenBW.
the class BW method onUnitMorph.
private void onUnitMorph(int unitId) {
Unit unit = this.units.get(unitId);
if (unit == null) {
logger.error("onUnitMorph: no unit found for ID {}.", unitId);
}
listener.onUnitMorph(unit);
}
use of org.openbw.bwapi4j.unit.Unit in project BWAPI4J by OpenBW.
the class BW method onUnitComplete.
private void onUnitComplete(int unitId) {
Unit unit = this.units.get(unitId);
if (unit == null) {
logger.error("onUnitComplete: no unit found for ID {}.", unitId);
}
listener.onUnitComplete(unit);
}
Aggregations