private void Dispose() { foreach (UIButton button in buttons) { button.Dispose(); } buttons.Clear(); DisposeWalls(); if (uiPlayer != null) { uiPlayer.Dispose(); } if (uiAIPlayer != null) { uiAIPlayer.Dispose(); } if (food != null) { uiFood.Dispose(); } if (btnPause != null) { btnPause.Dispose(); } if (btnReplay != null) { btnReplay.Dispose(); } if (btnContinue != null) { btnContinue.Dispose(); } }