/// <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(); }
/// <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(); }