|
@@ -36,12 +36,21 @@ namespace GFGGame
|
|
|
private bool isFirst = true;
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
- for (int i = 0; i < _gameObjects.Count; i++)
|
|
|
+ // for (int i = 0; i < _gameObjects.Count; i++)
|
|
|
+ // {
|
|
|
+ // SceneController.DestroyObjectFromView(_gameObjects[i]);
|
|
|
+ // SceneController.DestroyObjectFromView(_gameObjects1[i]);
|
|
|
+ // }
|
|
|
+ ICollection keys0 = dicGameobj.Keys;
|
|
|
+ foreach (int key in keys0)
|
|
|
{
|
|
|
- SceneController.DestroyObjectFromView(_gameObjects[i]);
|
|
|
- SceneController.DestroyObjectFromView(_gameObjects1[i]);
|
|
|
- }
|
|
|
+ for (int i = 0; i < dicGameobj[key].Count; i++)
|
|
|
+ {
|
|
|
+ SceneController.DestroyObjectFromView(dicGameobj[key][i]);
|
|
|
+ SceneController.DestroyObjectFromView(dicGameobj1[key][i]);
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
base.Dispose();
|
|
|
}
|
|
|
|