public void destroyUnit() { health = 0; shields = 0; zombieInfectedTurns = 0; viperInfectedTurns = 0; animations.put(DEATH_EXPLOSION, createDeathExplosionAnim(false)); animations.remove(ENERGON_TRANSFER); }
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++; }
private void maybeAskForBackup() throws GameActionException { MapLocation waypointLocation = null; Robot[] nearbyFriendlyRobots = rc.senseNearbyGameObjects(Robot.class, 35, myTeam); Map<Robot, RobotInfo> nearbyFriendlyRobotInfo = senseAllRobotInfo(nearbyFriendlyRobots); nearbyFriendlyRobots = nearbyFriendlyRobotInfo.keySet().toArray(new Robot[0]); int numNearbyFriendlySoldiers = countSoldiers(nearbyFriendlyRobotInfo); if (numNearbyFriendlySoldiers < 4 || myHealth < myRobotType.maxHealth) { waypointLocation = myLocation; } if (waypointLocation != null) { rc.broadcast(RADIO_CHANNEL_PASTR_BACKUP, locationToInt(waypointLocation)); } else { rc.broadcast(RADIO_CHANNEL_PASTR_BACKUP, 0); } }
public boolean isAlive() { Animation deathAnim = animations.get(Animation.AnimationType.DEATH_EXPLOSION); return deathAnim == null || deathAnim.isAlive(); }