public void tick() { for (Class<? extends Actor> cls : actOrder) for (Actor actor : getActors(cls)) { if (!actor.expired() && !actor.getClass().equals(Player.class)) { actor.act(); } } removeExpired(); }
/** * Show the current status of the field. * * @param step Which iteration step it is. * @param field The field whose status is to be displayed. */ public void showStatus(int step, Field field) { if (!isVisible()) setVisible(true); stepLabel.setText(STEP_PREFIX + step); stats.reset(); fieldView.preparePaint(); for (int row = 0; row < field.getDepth(); row++) { for (int col = 0; col < field.getWidth(); col++) { Actor actor = field.getActorAt(row, col); if (actor != null) { stats.incrementCount(actor.getClass()); fieldView.drawMark(col, row, getColor(actor.getClass())); } else { fieldView.drawMark(col, row, EMPTY_COLOR); } } } stats.countFinished(); population.setText(POPULATION_PREFIX + stats.getPopulationDetails(field)); fieldView.repaint(); }