ScrollingShooter.GameObjectManager.AddGameObject C# (CSharp) Method

AddGameObject() private method

Helper method that adds a GameObject to the GameObjectManager
private AddGameObject ( ScrollingShooter.GameObject gameObject ) : void
gameObject ScrollingShooter.GameObject The Game Object to add
return void
        private void AddGameObject(GameObject gameObject)
        {
            uint id = gameObject.ID;

            // Store the game object in our list of all game objects
            gameObjects.Add(id, gameObject);

            // Create the game object's bounding box
            BoundingBox box = new BoundingBox(id, gameObject.Bounds);
            boundingBoxes.Add(id, box);

            // Store the new game object's bounds in our vertical axis list
            int topIndex = InsertBoundIntoAxis(verticalAxis, box.Top);
            int bottomIndex = InsertBoundIntoAxis(verticalAxis, box.Bottom);

            // Grab any game object ids for game objects whose bounds fall
            // between the min and max of our new game object
            for (int i = topIndex + 1; i < bottomIndex; i++)
            {
                verticalOverlaps.Add(new CollisionPair(id, verticalAxis[i].Box.GameObjectID));
            }
        }