コード例 #1
0
        ///////////////////////////////////////////////////////
        //
        // Private Methods
        //
        ///////////////////////////////////////////////////////



        ///////////////////////////////////////////////////////
        //
        // Contracts
        //
        ///////////////////////////////////////////////////////

        protected override void FillReserve(int fillSize)
        {
            for (int i = fillSize; i > 0; i--)
            {
                CollisionPairEvaluator newNode = new CollisionPairEvaluator();
                this.reservedList.PushFront(newNode);
            }
        }
コード例 #2
0
        ///////////////////////////////////////////////////////
        //
        // Methods
        //
        ///////////////////////////////////////////////////////


        /// <summary>
        ///		Creates a new collison pair to be evaluated
        /// </summary>
        /// <param name="newName"></param>
        /// <returns></returns>
        public CollisionPairEvaluator Create(CollisionPairEvaluator.Name newName, int numOfChecks = 1)
        {
            Debug.Assert(newName != CollisionPairEvaluator.Name.UNINITIALIZED);

            CollisionPairEvaluator newCollison = this.BaseCreate() as CollisionPairEvaluator;

            newCollison.SetName(newName);
            newCollison.SetNumberOfChecks(numOfChecks);
            return(newCollison);
        }
コード例 #3
0
        /// <summary>
        ///		Check all collisions in every collison pair
        /// </summary>
        public void Update()
        {
            CollisionPairEvaluator collisionPair = this.activeList.Head as CollisionPairEvaluator;

            // Loop through all collision pairs
            while (collisionPair != null)
            {
                collisionPair.Update();
                collisionPair = collisionPair.next as CollisionPairEvaluator;
            }
        }
コード例 #4
0
        /// <summary>
        ///		Recycles the given collison pair into the object pool
        /// </summary>
        /// <param name="oldName"></param>
        /// <returns></returns>
        public bool Recycle(CollisionPairEvaluator.Name oldName)
        {
            Debug.Assert(oldName != CollisionPairEvaluator.Name.UNINITIALIZED);

            CollisionPairEvaluator oldCollison = this.BaseRecycle(oldName) as CollisionPairEvaluator;

            if (oldCollison == null)
            {
                return(false);
            }
            oldCollison.Reset();
            return(true);
        }