コード例 #1
0
        /// <summary>
        /// Disposes of the interactive entities and clears the list.
        /// </summary>
        /// <param name="physicsWorld">The physics world containing the entities' bodies.</param>
        /// <param name="interactiveEntities">the list of interactive entities.</param>
        /// <param name="mineCart">The mine cart.</param>
        /// <param name="cartSwitch">The switch entity.</param>
        public static void DisposeOfInteractiveEntities(ref World physicsWorld, ref List <InteractiveEntity> interactiveEntities, ref MineCart mineCart, ref Switch cartSwitch)
        {
            if (mineCart != null)
            {
                mineCart.Dispose(ref physicsWorld);
                mineCart = null;
                cartSwitch.Dispose(ref physicsWorld);
                cartSwitch = null;
            }

            foreach (InteractiveEntity entity in interactiveEntities)
            {
                entity.Dispose(ref physicsWorld);
            }

            interactiveEntities.Clear();
        }
コード例 #2
0
ファイル: LevelFactory.cs プロジェクト: K-Cully/SticKart
        /// <summary>
        /// Disposes of the interactive entities and clears the list.
        /// </summary>
        /// <param name="physicsWorld">The physics world containing the entities' bodies.</param>
        /// <param name="interactiveEntities">the list of interactive entities.</param>
        /// <param name="mineCart">The mine cart.</param>
        /// <param name="cartSwitch">The switch entity.</param>
        public static void DisposeOfInteractiveEntities(ref World physicsWorld, ref List<InteractiveEntity> interactiveEntities, ref MineCart mineCart, ref Switch cartSwitch)
        {
            if (mineCart != null)
            {
                mineCart.Dispose(ref physicsWorld);
                mineCart = null;
                cartSwitch.Dispose(ref physicsWorld);
                cartSwitch = null;
            }

            foreach (InteractiveEntity entity in interactiveEntities)
            {
                entity.Dispose(ref physicsWorld);
            }

            interactiveEntities.Clear();
        }