public static void iocStart() { String[] ids = {"mainUnit", "supportUnit", "magUnit"}; AbstractApplicationContext aac; Path conf = Paths.get("simple.xml"); ApplicationContext context = new FileSystemXmlApplicationContext(conf.toAbsolutePath().toString()); for (String id : ids) { Unit u = (Unit) context.getBean(id); u.doMission(); } }
@Override public void completeTurn(LevelMap map, Bot thisP, GameModel myState) { ArrayList<Unit> units = myState.getCurrentPlayer().getPlayerUnits().getData(); Iterator<Unit> it = units.iterator(); Unit unit = it.next(); UnitButtonMove myMV = new UnitButtonMove(); myState.setSelectedUnit(unit); Tile unitTileisOn = map.getTileByCoords(unit.getXTileLoc(), unit.getYTileLoc()); myState.setSelectedTile(unitTileisOn); Tile selectedDestination = map.getTileByCoords(6, 5); myState.setSelectedDestination(selectedDestination); myMV.performButton(myState); }
@Override public void performEmptyAction(GameObject gameObj) { if (gameObj instanceof Unit) { ((Unit) gameObj).kill(); } else if (gameObj instanceof Building) { ((Building) gameObj).destroy(); } }