/// <summary>
        /// Removes a Game object from the axis
        /// </summary>
        /// <param name="gameObject">The game object to remove</param>
        private void RemoveGameObject(GameObject gameObject)
        {
            uint id = gameObject.ID;

            // Remove the game object from our list of all game objects
            gameObjects.Remove(id);

            // Remove the game object from our collection of collisions
            int i = collisions.Count - 1;
            while (i >= 0)
            {
                CollisionPair pair = collisions.ElementAt(i);
                if (pair.A == id || pair.B == id)
                    collisions.Remove(pair);
                i--;
            }

            // Remove the game object from our collection of overlaps
            i = horizontalOverlaps.Count - 1;
            while (i >= 0)
            {
                CollisionPair pair = horizontalOverlaps.ElementAt(i);
                if (pair.A == id || pair.B == id)
                    horizontalOverlaps.Remove(pair);
                i--;
            }
            i = verticalOverlaps.Count - 1;
            while (i >= 0)
            {
                CollisionPair pair = verticalOverlaps.ElementAt(i);
                if (pair.A == id || pair.B == id)
                    verticalOverlaps.Remove(pair);
                i--;
            }
            BoundingBox box=null;
            // Grab the game object's bounding box
            try
            {
                box = boundingBoxes[id];
            }
            catch
            {
            }
            // Remove the game objects' bounds from our horizontal axis lists
            if (box != null)
            {
                horizontalAxis.Remove(box.Left);
                horizontalAxis.Remove(box.Right);
                verticalAxis.Remove(box.Top);
                verticalAxis.Remove(box.Bottom);
            }
            // Remove the game object's bounding box
            boundingBoxes.Remove(id);
        }
        /// <summary>
        /// Helper method that adds a GameObject to the GameObjectManager
        /// </summary>
        /// <param name="gameObject">The Game Object to add</param>
        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 game object's bounds in our horizontal axis list
            int leftIndex = InsertBoundIntoAxis(horizontalAxis, box.Left);
            int rightIndex = InsertBoundIntoAxis(horizontalAxis, box.Right);

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

            // 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));
            }
        }
 /// <summary>
 /// Helper method for enqueueing our game object for creation at the 
 /// start of the next update cycle.  
 /// </summary>
 /// <param name="go">The ready-to-spawn game object</param>
 private void QueueGameObjectForCreation(GameObject go)
 {
     createdGameObjects.Enqueue(go);
 }
        /// <summary>
        /// Removes a Game object from the axis
        /// </summary>
        /// <param name="gameObject">The game object to remove</param>
        private void RemoveGameObject(GameObject gameObject)
        {
            uint id = gameObject.ID;

            // Remove the game object from our list of all game objects
            gameObjects.Remove(id);

            // Remove the game object from our collection of collisions
            CollisionPair[] pairs = collisions.ToArray();
            foreach (CollisionPair pair in pairs)
            {
                if (pair.A == id || pair.B == id)
                {
                    collisions.Remove(pair);
                }
            }

            // Remove the game object from our collection of overlaps
            CollisionPair[] pairs2 = verticalOverlaps.ToArray();
            foreach (CollisionPair pair in pairs2)
            {
                if (pair.A == id || pair.B == id)
                {
                    verticalOverlaps.Remove(pair);
                }
            }

            // Grab the game object's bounding box
            BoundingBox box;
            try
            {
                box = boundingBoxes[id];
            }
            catch (KeyNotFoundException ke)
            {
                return;
            }

            // Remove the game objects' bounds from our vertical axis lists
            verticalAxis.Remove(box.Top);
            verticalAxis.Remove(box.Bottom);

            // Remove the game object's bounding box
            boundingBoxes.Remove(id);
        }