public void moveObject(Agent a, String direction) { XYLocation presentLocation = (XYLocation)a.getAttribute(LOCATION); XYLocation locationToMoveTo = presentLocation.locationAt(direction); if (!(isBlocked(locationToMoveTo))) { moveObjectToAbsoluteLocation(a, locationToMoveTo); } }
public void moveObject(Agent a, String direction) { XYLocation presentLocation = (XYLocation) a.getAttribute(LOCATION); XYLocation locationToMoveTo = presentLocation.locationAt(direction); if (!(isBlocked(locationToMoveTo))) { moveObjectToAbsoluteLocation(a, locationToMoveTo); } }
public ArrayList getObjectsNear(Agent agent, int radius) { ArrayList retval = new ArrayList(); XYLocation agentLocation = (XYLocation) agent.getAttribute(LOCATION); ArrayList all = getAllObjects(); foreach (ObjectWithDynamicAttributes a in all) { if (!(a.Equals(agent))) { XYLocation otherAgentLocation = (XYLocation) a .getAttribute(LOCATION); if (withinRadius(radius, agentLocation, otherAgentLocation)) { retval.Add(a); } } } return retval; }
public ArrayList getObjectsNear(Agent agent, int radius) { ArrayList retval = new ArrayList(); XYLocation agentLocation = (XYLocation)agent.getAttribute(LOCATION); ArrayList all = getAllObjects(); foreach (ObjectWithDynamicAttributes a in all) { if (!(a.Equals(agent))) { XYLocation otherAgentLocation = (XYLocation)a .getAttribute(LOCATION); if (withinRadius(radius, agentLocation, otherAgentLocation)) { retval.Add(a); } } } return(retval); }