@Override public void logic() throws PogamutException { super.logic(); myInitialize(); double levelTime = this.game.getTime(); double speed = this.bot.getVelocity().size(); double skipTime = 0; if (lastTime > 0) { skipTime = levelTime - lastTime; } double distance_estimate = skipTime * speed; if (sequence != null && sequence.hasNext()) { Point pose; if (distance_estimate > 0) { pose = sequence.nextByDistance(distance_estimate); } else { pose = sequence.nextByTime(skipTime); } Location current = this.getAgentMemory().getAgentLocation().getLocation(); Location next = pose.getLocation(); if (next.getDistance(current) > SPACE_DISCONTINUITY) { System.out.println("RESPAWN: space discontinuity"); this.body.getAction().respawn(pose.getLocation(), pose.getRotation()); } else { this.move.moveTo(pose.getLocation()); } System.out.println("current: " + current + " next: " + next); System.out.println("level: " + levelTime + " data: " + pose.getT() + " skip: " + skipTime); } else { if (sequenceIter == null) { sequenceIter = sequences.iterator(); } if (sequenceIter.hasNext()) { sequence = sequenceIter.next(); if (sequence.hasNext()) { Point pose = sequence.nextByTime(skipTime); this.body.getAction().respawn(pose.getLocation(), pose.getRotation()); } } } lastTime = levelTime; }
public boolean isInRange(Location location) { return Location.getDistance(move.getLocation(), location) < 5.5; }