Ejemplo n.º 1
0
 public void addItem(GameObject o)
 {
     // keep track of the fact that we have to manage this item
     this.loadedObjects.Add(o);
     // get the object's bounding box
     // decide whether to compare against the smaller character reality bubble or the larger terrain reality bubble
     if (o.isMovable())
     {
         this.characterSearcher.addItem(o);
         IndexBox activeIndices = this.characterSearcher.getIndexBoxFromWorldBox(this.realityBubble.getActiveRegion());
         IndexBox objectIndices = this.characterSearcher.getIndexBoxFromWorldBox(o.getBoundingBox());
         if (activeIndices.intersects(objectIndices))
         {
             this.world.addItem(o);
         }
     }
     else
     {
         this.terrainSearcher.addItem(o);
         IndexBox existenceIndices = this.terrainSearcher.getIndexBoxFromWorldBox(this.realityBubble.getExistentRegion());
         IndexBox objectIndices    = this.terrainSearcher.getIndexBoxFromWorldBox(o.getBoundingBox());
         if (existenceIndices.intersects(objectIndices))
         {
             this.world.addItem(o);
         }
     }
 }