public ArrayList getObjectsWithin (OurGameObject origin, float radius) { ArrayList toReturn = new ArrayList (); foreach (OurGameObject obj in gameObjects) { if (obj.distanceTo (origin).magnitude < radius) { toReturn.Add (obj); } } return toReturn; }
public void removeObject (OurGameObject toRemove) { gameObjects.Remove (toRemove); }
public void addObject (OurGameObject toAdd) { gameObjects.Add (toAdd); toAdd.world = this; }
public Vector2 distanceTo(OurGameObject other) { return new Vector2 ( other.transform.localPosition.x - this.transform.localPosition.x, other.transform.localPosition.y - this.transform.localPosition.y); }