@SuppressWarnings("unchecked") public AbstractDrawObject(int currentRound, AbstractDrawObject copy) { this(currentRound, copy.info.type, copy.info.team, copy.getID()); loc = copy.loc; dir = copy.dir; health = copy.health; shields = copy.shields; flux = copy.flux; moving = copy.moving; broadcast = copy.broadcast; controlBits = copy.controlBits; bytecodesUsed = copy.bytecodesUsed; System.arraycopy( copy.indicatorStrings, 0, indicatorStrings, 0, GameConstants.NUMBER_OF_INDICATOR_STRINGS); turnedOn = copy.turnedOn; loaded = copy.loaded; regen = copy.regen; actions = (LinkedList<Action>) actions.clone(); attackDelay = copy.attackDelay; movementDelay = copy.movementDelay; hats = copy.hats; for (Map.Entry<Animation.AnimationType, Animation> entry : copy.animations.entrySet()) { animations.put(entry.getKey(), (Animation) entry.getValue().clone()); } updateDrawLoc(); }
public void updateRound() { ListIterator<Action> actionIterator = actions.listIterator(); while (actionIterator.hasNext()) { Action a = actionIterator.next(); if (currentRound >= (a.roundStarted + a.length)) { actionIterator.remove(); } } aliveRounds += 1; updateDrawLoc(); broadcast = (broadcast << 1) & 0x000FFFFF; if (regen > 0) regen--; Iterator<Map.Entry<Animation.AnimationType, Animation>> it = animations.entrySet().iterator(); Map.Entry<Animation.AnimationType, Animation> entry; while (it.hasNext()) { entry = it.next(); entry.getValue().updateRound(); if (!entry.getValue().isAlive()) { if (entry.getKey() != DEATH_EXPLOSION) it.remove(); } } currentRound++; }