Beispiel #1
0
        // 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 = null;
            for (int i = 0; i < 2; ++i) // loop through the platform and scenes
            {
                if (i == 0)             // scene
                {
                    childObjects = infiniteObject.GetComponentsInChildren <SceneObject>(true);
                }
                else
                {
                    childObjects = infiniteObject.GetComponentsInChildren <PlatformObject>(true);
                }

                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>(true);
                        }
                        else
                        {
                            childObjects = infiniteObject.GetComponentsInChildren <PlatformObject>(true);
                        }

                        for (int k = 0; k < childObjects.Length; ++k)
                        {
                            childObjects[k].Activate();
                        }
                    }
                }
            }
        }