// remove the saved infinite objects and activate the set of objects for the next game public void readyFromReset() { // deactivate the saved infinite objects from the previous game InfiniteObject infiniteObject = infiniteObjectHistory.getSavedInfiniteObjects(); InfiniteObject[] childObjects; for (int i = 0; i < 2; ++i) // loop through the platform and scenes { if (i == 0) // scene { childObjects = infiniteObject.GetComponentsInChildren <SceneObject>() as SceneObject[]; } else { childObjects = infiniteObject.GetComponentsInChildren <PlatformObject>() as PlatformObject[]; } for (int j = 0; j < childObjects.Length; ++j) { childObjects[j].deactivate(); } } // activate the objects for the current game for (int i = 0; i < 2; ++i) // loop through the platform and scenes { for (int j = 0; j < (int)ObjectLocation.Last; ++j) { infiniteObject = infiniteObjectHistory.getTopInfiniteObject((ObjectLocation)j, i == 0); if (infiniteObject != null) { if (i == 0) // scene { childObjects = infiniteObject.GetComponentsInChildren <SceneObject>() as SceneObject[]; } else { childObjects = infiniteObject.GetComponentsInChildren <PlatformObject>() as PlatformObject[]; } for (int k = 0; k < childObjects.Length; ++k) { childObjects[k].activate(); } } } } }