Beispiel #1
0
    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;
    }
Beispiel #2
0
 public void removeObject (OurGameObject toRemove) {
     gameObjects.Remove (toRemove);
 }
Beispiel #3
0
 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);
 }