@Override protected void initializeRound() { super.initializeRound(); final ITurnSnapshot snapshot = recordManager.readSnapshot(currentTime); if (snapshot != null) { eventDispatcher.onRoundStarted(new RoundStartedEvent(snapshot, getRoundNum())); } }
@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 finalizeTurn() { final ITurnSnapshot snapshot = recordManager.readSnapshot(currentTime); if (snapshot != null) { final IRobotSnapshot[] robots = snapshot.getRobots(); for (int i = 0; i < robots.length; i++) { RobotSnapshot robot = (RobotSnapshot) robots[i]; robot.setPaintEnabled(paint[i]); } eventDispatcher.onTurnEnded(new TurnEndedEvent(snapshot)); } super.finalizeTurn(); }
@Override public void cleanup() { super.cleanup(); recordManager.cleanupStreams(); }