private void DestroyLevel() { gameplayLayer.RemoveChild(player); player.Dispose(); gameplayLayer.RemoveChild(door); door.Dispose(); for (int i = coins.Count - 1; i > -1; i--) { var coinToDestroy = coins [i]; DestroyCoin(coinToDestroy); } for (int i = damageDealers.Count - 1; i > -1; i--) { var damageDealer = damageDealers [i]; DestroyDamageDealer(damageDealer); } // We can just clear the list - the contained entities are destroyed as damage dealers: enemies.Clear(); touchScreen.Dispose(); this.RemoveChild(currentLevel); currentLevel.Dispose(); // don't think we need to do anything with LevelCollision }
private void DestroyLevel() { gameplayLayer.RemoveChild(player); player.Dispose(); gameplayLayer.RemoveChild(exit); exit.Dispose(); for (int i = mice.Count - 1; i > -1; i--) { var mouseToDestroy = mice[i]; DestroyMouse(mouseToDestroy); } for (int i = damageDealers.Count - 1; i > -1; i--) { var damageDealer = damageDealers[i]; DestroyDamageDealer(damageDealer); } // We can just clear the list - the contained entities are destroyed as damage dealers: enemies.Clear(); touchScreen.Dispose(); this.RemoveChild(currentLevel); currentLevel.Dispose(); }