private void pauseImpl() { isPaused = true; stepCount = 0; eventDispatcher.onBattlePaused(new BattlePausedEvent()); }
public synchronized void pauseBattle() { if (++pauseCount == 1) { if (battle != null && battle.isRunning()) { battle.pause(); } else { battleEventDispatcher.onBattlePaused(new BattlePausedEvent()); } } }
public synchronized void pauseIfResumedBattle() { if (pauseCount == 0) { pauseCount++; if (battle != null && battle.isRunning()) { battle.pause(); } else { battleEventDispatcher.onBattlePaused(new BattlePausedEvent()); } } }
@Override protected void initializeBattle() { super.initializeBattle(); recordManager.prepareInputStream(); battleRules = recordManager.recordInfo.battleRules; paint = new boolean[recordManager.recordInfo.robotCount]; eventDispatcher.onBattleStarted(new BattleStartedEvent(battleRules, recordManager.recordInfo.robotCount, true)); if (isPaused) { eventDispatcher.onBattlePaused(new BattlePausedEvent()); } }
@Override protected void preloadRound() { super.preloadRound(); computeActiveRobots(); // Used for robotPeer.initializeRound() // At this point the unsafe loader thread will now set itself to wait for a notify for (RobotPeer robotPeer : robots) { robotPeer.initializeRound(robots, initialRobotSetups); robotPeer.println("========================="); robotPeer.println("Round " + (getRoundNum() + 1) + " of " + getNumRounds()); robotPeer.println("========================="); } if (getRoundNum() == 0) { eventDispatcher.onBattleStarted(new BattleStartedEvent(battleRules, robots.size(), false)); if (isPaused) { eventDispatcher.onBattlePaused(new BattlePausedEvent()); } } computeActiveRobots(); // Used for RoundEnded check hostManager.resetThreadManager(); }