Пример #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
        /// <summary>
        /// Disposes of the platforms and clears the list.
        /// </summary>
        /// <param name="physicsWorld">The physics world containing the platforms' bodies.</param>
        /// <param name="platforms">The list of platforms.</param>
        public static void DisposeOfPlatforms(ref World physicsWorld, ref List<Platform> platforms)
        {
            foreach (Platform platform in platforms)
            {
                platform.Dispose(ref physicsWorld);
            }

            platforms.Clear();
        }
Пример #3
0
        /// <summary>
        /// Removes the floor bodies from the world and clears the list.
        /// </summary>
        /// <param name="physicsWorld">The physics world containing the floor.</param>
        /// <param name="floorEdges">The list of floor edge bodies.</param>
        /// <param name="visualFloorEdges">The list of visual floor edges.</param>
        public static void DisposeOfFloor(ref World physicsWorld, ref List<Body> floorEdges, ref List<VisualEdge> visualFloorEdges)
        {
            visualFloorEdges.Clear();
            foreach (Body body in floorEdges)
            {
                physicsWorld.RemoveBody(body);
            }

            floorEdges.Clear();
        }