Пример #1
0
        public override void Destroy()
        {
            base.Destroy();
            FlatRedBall.SpriteManager.RemoveDrawableBatch(EndingScreenGum); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= EndingScreenGum.HandleResolutionChanged;
            EndingScreenGum = null;
            EndingText      = null;
            negative        = null;
            neutral         = null;
            positive        = null;
            EndingCredits   = null;

            if (EndingScreenGumInstance != null)
            {
                EndingScreenGumInstance.RemoveFromManagers();
            }
            if (EndingTextRuntimeInstance != null)
            {
                EndingTextRuntimeInstance.RemoveFromManagers();
            }
            if (ButtonInstance != null)
            {
                ButtonInstance.RemoveFromManagers();
            }
            if (EndingTextContainer != null)
            {
                EndingTextContainer.RemoveFromManagers();
            }
            if (CurrentMusicDisplayInstance != null)
            {
                CurrentMusicDisplayInstance.RemoveFromManagers();
            }
            if (CreditsContainer != null)
            {
                CreditsContainer.RemoveFromManagers();
            }
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
        public override void Destroy()
        {
            base.Destroy();
            Factories.BombardingTowerFactory.Destroy();
            Factories.ChemicalTowerFactory.Destroy();
            Factories.ElectricTowerFactory.Destroy();
            Factories.FireTowerFactory.Destroy();
            Factories.FrostTowerFactory.Destroy();
            Factories.PiercingTowerFactory.Destroy();
            Factories.CannonProjectileFactory.Destroy();
            Factories.ChemicalProjectileFactory.Destroy();
            Factories.ElectricProjectileFactory.Destroy();
            Factories.FireProjectileFactory.Destroy();
            Factories.FrostProjectileFactory.Destroy();
            Factories.PiercingProjectileFactory.Destroy();
            worldmap = null;
            FlatRedBall.SpriteManager.RemoveDrawableBatch(MapScreenGum); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= MapScreenGum.HandleResolutionChanged;
            MapScreenGum       = null;
            Messages           = null;
            StructureSelection = null;

            StructureList.MakeOneWay();
            ProjectileList.MakeOneWay();
            if (MapScreenGumInstance != null)
            {
                MapScreenGumInstance.RemoveFromManagers();
            }
            if (MenuWindowInstance != null)
            {
                MenuWindowInstance.RemoveFromManagers();
            }
            if (ChatHistoryInstance != null)
            {
                ChatHistoryInstance.RemoveFromManagers();
            }
            if (TowerSelectionBoxInstance != null)
            {
                TowerSelectionBoxInstance.RemoveFromManagers();
            }
            for (int i = StructureList.Count - 1; i > -1; i--)
            {
                StructureList[i].Destroy();
            }
            if (StructureLayer != null)
            {
                FlatRedBall.SpriteManager.RemoveLayer(StructureLayer);
            }
            for (int i = ProjectileList.Count - 1; i > -1; i--)
            {
                ProjectileList[i].Destroy();
            }
            if (OkMessageInstance != null)
            {
                OkMessageInstance.RemoveFromManagers();
            }
            if (ConfirmationWindowInstance != null)
            {
                ConfirmationWindowInstance.RemoveFromManagers();
            }
            if (HUDLayer != null)
            {
                FlatRedBall.SpriteManager.RemoveLayer(HUDLayer);
            }
            if (CurrentMusicDisplayInstance != null)
            {
                CurrentMusicDisplayInstance.RemoveFromManagers();
            }
            StructureList.MakeTwoWay();
            ProjectileList.MakeTwoWay();
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }