コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContactSetCollection.Enumerator"/> struct.
 /// </summary>
 /// <param name="collection">The <see cref="ContactSetCollection"/> to be enumerated.</param>
 internal Enumerator(ContactSetCollection collection)
 {
   _collection = collection;
   _index = 0;
   _version = collection._version;
   _current = null;
 }
コード例 #2
0
 public static IEnumerable<ContactSet> Create(ContactSetCollection collection, CollisionObject collisionObject)
 {
   var enumerable = Pool.Obtain();
   enumerable._collection = collection;
   enumerable._collisionObject = collisionObject;
   enumerable._index = 0;
   return enumerable;
 }
コード例 #3
0
        /// <summary>
        /// Creates a <see cref="ContactSetCollection"/> from an <see cref="IEnumerable{ContactSet}"/>.
        /// </summary>
        /// <param name="contactSets">The contact sets.</param>
        /// <returns>
        /// A <see cref="ContactSetCollection"/> that contains the elements from the input sequence.
        /// </returns>
        public static ContactSetCollection ToContactSetCollection(this IEnumerable <ContactSet> contactSets)
        {
            ContactSetCollection collection = contactSets as ContactSetCollection;

            if (collection != null)
            {
                return(collection);
            }

            return(new ContactSetCollection(contactSets));
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CollisionDetectionBroadPhase"/> class.
        /// </summary>
        public CollisionDetectionBroadPhase(CollisionDomain collisionDomain)
        {
            _collisionDomain = collisionDomain;

            // Register event handler.
            _collisionDomain.CollisionObjects.CollectionChanged += OnCollisionObjectsChanged;

            // Per default we use Sweep and Prune.
            SpatialPartition = new SweepAndPruneSpace <CollisionObject>();

            CandidatePairs = new ContactSetCollection();
        }
コード例 #5
0
 protected override void OnRecycle()
 {
   _collection = null;
   _collisionObject = null;
   Pool.Recycle(this);
 }
コード例 #6
0
 public ContactSetCollectionView(ContactSetCollection collection)
 {
   _collection = collection;
 }
コード例 #7
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting 
 /// unmanaged resources.
 /// </summary>
 public void Dispose()
 {
   _collection = null;
   _current = null;
 }