destroy() public method

public destroy ( ) : void
return void
Exemplo n.º 1
0
        /// <summary>
        /// Returns true if the two FlxObjects overlap.  Optional Callback function of return type bool with two FlxObject parameters will be called if true.
        /// </summary>
        /// <param name="ObjectOrGroup1"></param>
        /// <param name="ObjectOrGroup2"></param>
        /// <param name="NotifyCallback"></param>
        /// <param name="ProcessCallback"></param>
        /// <returns></returns>
        static public Boolean overlap(FlxObject ObjectOrGroup1 = null, FlxObject ObjectOrGroup2 = null, Func <FlxObject, FlxObject, Boolean> NotifyCallback = null, Func <FlxObject, FlxObject, Boolean> ProcessCallback = null)
        {
            if (ObjectOrGroup1 == null)
            {
                ObjectOrGroup1 = FlxG.state;
            }
            if (ObjectOrGroup2 == ObjectOrGroup1)
            {
                ObjectOrGroup2 = null;
            }
            FlxQuadTree.divisions = FlxG.worldDivisions;
            FlxQuadTree quadTree = new FlxQuadTree(FlxG.worldBounds.x, FlxG.worldBounds.y, FlxG.worldBounds.width, FlxG.worldBounds.height);

            quadTree.load(ObjectOrGroup1, ObjectOrGroup2, NotifyCallback, ProcessCallback);
            Boolean result = quadTree.execute();

            quadTree.destroy();
            return(result);
        }
Exemplo n.º 2
0
        public void destroy()
        {
            _headA.destroy();
            _headA = null;
            _tailA.destroy();
            _tailA = null;
            _headB.destroy();
            _headB = null;
            _tailB.destroy();
            _tailB = null;

            if (_northWestTree != null)
            {
                _northWestTree.destroy();
            }
            _northWestTree = null;
            if (_northEastTree != null)
            {
                _northEastTree.destroy();
            }
            _northEastTree = null;
            if (_southEastTree != null)
            {
                _southEastTree.destroy();
            }
            _southEastTree = null;
            if (_southWestTree != null)
            {
                _southWestTree.destroy();
            }
            _southWestTree = null;

            _object             = null;
            _processingCallback = null;
            _notifyCallback     = null;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Call this function to see if one <code>FlxObject</code> overlaps another.
        /// Can be called with one object and one group, or two groups, or two objects,
        /// whatever floats your boat! For maximum performance try bundling a lot of objects
        /// together using a <code>FlxGroup</code> (or even bundling groups together!).
        /// 
        /// <p>NOTE: does NOT take objects' scrollfactor into account, all overlaps are checked in world space.</p>
        /// </summary>
        /// <param name="ObjectOrGroup1">The first object or group you want to check.</param>
        /// <param name="ObjectOrGroup2">The second object or group you want to check. If it is the same as the first, flixel knows to just do a comparison within that group.</param>
        /// <param name="NotifyCallback">A function with two <code>FlxObject</code> parameters - e.g. <code>myOverlapFunction(Object1:FlxObject,Object2:FlxObject)</code> - that is called if those two objects overlap.</param>
        /// <param name="ProcessCallback">A function with two <code>FlxObject</code> parameters - e.g. <code>myOverlapFunction(Object1:FlxObject,Object2:FlxObject)</code> - that is called if those two objects overlap. If a ProcessCallback is provided, then NotifyCallback will only be called if ProcessCallback returns true for those objects!</param>
        /// <returns></returns>
        public static Boolean overlap(FlxObject ObjectOrGroup1 = null, FlxObject ObjectOrGroup2 = null, Func<FlxObject, FlxObject, Boolean> NotifyCallback = null, Func<FlxObject, FlxObject, Boolean> ProcessCallback = null)
        {
            if (ObjectOrGroup1 == null)
            {
                ObjectOrGroup1 = FlxG.State;
            }

            if (ObjectOrGroup2 == ObjectOrGroup1)
            {
                ObjectOrGroup2 = null;
            }

            FlxQuadTree.divisions = FlxG.worldDivisions;
            FlxQuadTree quadTree = new FlxQuadTree(FlxG.worldBounds.X, FlxG.worldBounds.Y, FlxG.worldBounds.Width, FlxG.worldBounds.Height);
            quadTree.load(ObjectOrGroup1, ObjectOrGroup2, NotifyCallback, ProcessCallback);
            Boolean result = quadTree.execute();
            quadTree.destroy();
            return result;
        }