Exemple #1
0
        public void moveObject(Agent a, String direction)
        {
            XYLocation presentLocation  = (XYLocation)a.getAttribute(LOCATION);
            XYLocation locationToMoveTo = presentLocation.locationAt(direction);

            if (!(isBlocked(locationToMoveTo)))
            {
                moveObjectToAbsoluteLocation(a, locationToMoveTo);
            }
        }
Exemple #2
0
		public void moveObject(Agent a, String direction) 
		{
			XYLocation presentLocation = (XYLocation) a.getAttribute(LOCATION);
			XYLocation locationToMoveTo = presentLocation.locationAt(direction);

			if (!(isBlocked(locationToMoveTo))) 
			{
				moveObjectToAbsoluteLocation(a, locationToMoveTo);
			}

		}
Exemple #3
0
		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;
		}
Exemple #4
0
        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);
        }