fliXNA_xbox.FlxQuadTree.overlapNode C# (CSharp) Method

overlapNode() protected method

protected overlapNode ( ) : System.Boolean
return System.Boolean
        protected Boolean overlapNode()
        {
            //Walk the list and check for overlaps
            Boolean overlapProcessed = false;
            FlxObject checkObject;
            while(_iterator != null)
            {
                if(!_object.Exists || (_object.AllowCollisions <= 0))
                    break;

                checkObject = _iterator.Object;
                if((_object == checkObject) || !checkObject.Exists || (checkObject.AllowCollisions <= 0))
                {
                    _iterator = _iterator.next;
                    continue;
                }

                //calculate bulk hull for _object
                _objectHullX = (_object.X < _object.Last.X)?_object.X:_object.Last.X;
                _objectHullY = (_object.Y < _object.Last.Y)?_object.Y:_object.Last.Y;
                _objectHullWidth = _object.X - _object.Last.X;
                _objectHullWidth = _object.Width + ((_objectHullWidth>0)?_objectHullWidth:-_objectHullWidth);
                _objectHullHeight = _object.Y - _object.Last.Y;
                _objectHullHeight = _object.Height + ((_objectHullHeight>0)?_objectHullHeight:-_objectHullHeight);

                //calculate bulk hull for checkObject
                _checkObjectHullX = (checkObject.X < checkObject.Last.X)?checkObject.X:checkObject.Last.X;
                _checkObjectHullY = (checkObject.Y < checkObject.Last.Y)?checkObject.Y:checkObject.Last.Y;
                _checkObjectHullWidth = checkObject.X - checkObject.Last.X;
                _checkObjectHullWidth = checkObject.Width + ((_checkObjectHullWidth>0)?_checkObjectHullWidth:-_checkObjectHullWidth);
                _checkObjectHullHeight = checkObject.Y - checkObject.Last.Y;
                _checkObjectHullHeight = checkObject.Height + ((_checkObjectHullHeight>0)?_checkObjectHullHeight:-_checkObjectHullHeight);

                //check for intersection of the two hulls
                if(	(_objectHullX + _objectHullWidth > _checkObjectHullX) &&
                    (_objectHullX < _checkObjectHullX + _checkObjectHullWidth) &&
                    (_objectHullY + _objectHullHeight > _checkObjectHullY) &&
                    (_objectHullY < _checkObjectHullY + _checkObjectHullHeight) )
                {
                    //Execute callback functions if they exist
                    if((_processingCallback == null) || _processingCallback(_object,checkObject))
                        overlapProcessed = true;
                    if(overlapProcessed && (_notifyCallback != null))
                        _notifyCallback(_object,checkObject);
                }
                _iterator = _iterator.next;
            }

            return overlapProcessed;
        }