Ejemplo n.º 1
0
        public static void LoadStaticContent(string contentManagerName)
        {
            if (string.IsNullOrEmpty(contentManagerName))
            {
                throw new System.ArgumentException("contentManagerName cannot be empty or null");
            }
            // Set the content manager for Gum
            var contentManagerWrapper = new FlatRedBall.Gum.ContentManagerWrapper();

            contentManagerWrapper.ContentManagerName = contentManagerName;
            RenderingLibrary.Content.LoaderManager.Self.ContentLoader = contentManagerWrapper;
            // Access the GumProject just in case it's async loaded
            var throwaway = GlobalContent.GumProject;

            #if DEBUG
            if (contentManagerName == FlatRedBall.FlatRedBallServices.GlobalContentManager)
            {
                HasBeenLoadedWithGlobalContentManager = true;
            }
            else if (HasBeenLoadedWithGlobalContentManager)
            {
                throw new System.Exception("This type has been loaded with a Global content manager, then loaded with a non-global.  This can lead to a lot of bugs");
            }
            #endif
            empty_building = FlatRedBall.FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/screens/mainmenu/empty_building.png", contentManagerName);
            AbbatoirIntergradeAnimation = FlatRedBall.FlatRedBallServices.Load <FlatRedBall.Graphics.Animation.AnimationChainList>(@"content/screens/mainmenu/abbatoirintergradeanimation.achx", contentManagerName);
            AbbatoirIntergradeText      = FlatRedBall.FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/screens/mainmenu/abbatoirintergradetext.png", contentManagerName);
            blue_eye = FlatRedBall.FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/screens/mainmenu/blue_eye.png", contentManagerName);
            Gum.Wireframe.GraphicalUiElement.IsAllLayoutSuspended = true;  MainMenuGum = new FlatRedBall.Gum.GumIdb();  MainMenuGum.LoadFromFile("content/gumproject/screens/mainmenugum.gusx");  MainMenuGum.AssignReferences(); Gum.Wireframe.GraphicalUiElement.IsAllLayoutSuspended = false; MainMenuGum.Element.UpdateLayout(); MainMenuGum.Element.UpdateLayout();
            CustomLoadStaticContent(contentManagerName);
        }
Ejemplo n.º 2
0
        public override void Initialize(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            // Not instantiating for LayeredTileMap Map in Screens\GameScreen (Screen) because properties on the object prevent it
            SolidCollisions = new FlatRedBall.TileCollisions.TileShapeCollection();
            PlayerList      = new FlatRedBall.Math.PositionedObjectList <MyNewGame.Entities.Player>();
            PlayerList.Name = "PlayerList";
            DoorList        = new FlatRedBall.Math.PositionedObjectList <MyNewGame.Entities.Door>();
            DoorList.Name   = "DoorList";
            gumIdb          = new FlatRedBall.Gum.GumIdb();
            // normally we wait to set variables until after the object is created, but in this case if the
            // TileShapeCollection doesn't have its Visible set before creating the tiles, it can result in
            // really bad performance issues, as shapes will be made visible, then invisible. Really bad perf!
            if (SolidCollisions != null)
            {
                SolidCollisions.Visible = false;
            }
            FlatRedBall.TileCollisions.TileShapeCollectionLayeredTileMapExtensions.AddCollisionFromTilesWithProperty(SolidCollisions, Map, "SolidCollision");


            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
Ejemplo n.º 3
0
        public override void Destroy()
        {
            base.Destroy();
            FlatRedBall.SpriteManager.RemoveDrawableBatch(ScoreboardGum); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= ScoreboardGum.HandleResolutionChanged;
            ScoreboardGum = null;

            if (LivesValue != null)
            {
                LivesValue.RemoveFromManagers();
            }
            if (ScoreValue != null)
            {
                ScoreValue.RemoveFromManagers();
            }
            if (TimerValue != null)
            {
                TimerValue.RemoveFromManagers();
            }
            if (LivesContainer != null)
            {
                LivesContainer.RemoveFromManagers();
            }
            if (ScoreboardGumRuntime != null)
            {
                ScoreboardGumRuntime.RemoveFromManagers();
            }
            if (DifficultyValue != null)
            {
                DifficultyValue.RemoveFromManagers();
            }
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
Ejemplo n.º 4
0
        public static new void LoadStaticContent(string contentManagerName)
        {
            if (string.IsNullOrEmpty(contentManagerName))
            {
                throw new System.ArgumentException("contentManagerName cannot be empty or null");
            }
            Frbcon2019.Screens.MiniGameBase.LoadStaticContent(contentManagerName);
            // Set the content manager for Gum
            var contentManagerWrapper = new FlatRedBall.Gum.ContentManagerWrapper();

            contentManagerWrapper.ContentManagerName = contentManagerName;
            RenderingLibrary.Content.LoaderManager.Self.ContentLoader = contentManagerWrapper;
            // Access the GumProject just in case it's async loaded
            var throwaway = GlobalContent.CoreUIs;

            #if DEBUG
            if (contentManagerName == FlatRedBall.FlatRedBallServices.GlobalContentManager)
            {
                HasBeenLoadedWithGlobalContentManager = true;
            }
            else if (HasBeenLoadedWithGlobalContentManager)
            {
                throw new System.Exception("This type has been loaded with a Global content manager, then loaded with a non-global.  This can lead to a lot of bugs");
            }
            #endif
            Gum.Wireframe.GraphicalUiElement.IsAllLayoutSuspended = true;  MemoryGameGum = new FlatRedBall.Gum.GumIdb();  MemoryGameGum.LoadFromFile("content/gumproject/screens/memorygamegum.gusx");  MemoryGameGum.AssignReferences(); Gum.Wireframe.GraphicalUiElement.IsAllLayoutSuspended = false; MemoryGameGum.Element.UpdateLayout(); MemoryGameGum.Element.UpdateLayout();
            CustomLoadStaticContent(contentManagerName);
        }
Ejemplo n.º 5
0
        public static void LoadStaticContent(string contentManagerName)
        {
            if (string.IsNullOrEmpty(contentManagerName))
            {
                throw new System.ArgumentException("contentManagerName cannot be empty or null");
            }
            // Set the content manager for Gum
            var contentManagerWrapper = new FlatRedBall.Gum.ContentManagerWrapper();

            contentManagerWrapper.ContentManagerName = contentManagerName;
            RenderingLibrary.Content.LoaderManager.Self.ContentLoader = contentManagerWrapper;
            // Access the GumProject just in case it's async loaded
            var throwaway = GlobalContent.GumProject;

            #if DEBUG
            if (contentManagerName == FlatRedBall.FlatRedBallServices.GlobalContentManager)
            {
                HasBeenLoadedWithGlobalContentManager = true;
            }
            else if (HasBeenLoadedWithGlobalContentManager)
            {
                throw new System.Exception("This type has been loaded with a Global content manager, then loaded with a non-global.  This can lead to a lot of bugs");
            }
            #endif
            TestLevel = FlatRedBall.TileGraphics.LayeredTileMap.FromTiledMapSave("content/screens/gamescreen/levels/testlevel.tmx", contentManagerName);
            Gum.Wireframe.GraphicalUiElement.IsAllLayoutSuspended = true;  GameScreenGum = new FlatRedBall.Gum.GumIdb();  GameScreenGum.LoadFromFile("content/gumproject/screens/gamescreengum.gusx");  GameScreenGum.AssignReferences(); Gum.Wireframe.GraphicalUiElement.IsAllLayoutSuspended = false; GameScreenGum.Element.UpdateLayout(); GameScreenGum.Element.UpdateLayout();
            GreasyPlatypusSlapper.Entities.CameraEntity.LoadStaticContent(contentManagerName);
            CustomLoadStaticContent(contentManagerName);
        }
Ejemplo n.º 6
0
        public override void Initialize(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            Map    = Level2File;
            gumIdb = new FlatRedBall.Gum.GumIdb();


            base.Initialize(addToManagers);
        }
        public override void Destroy()
        {
            base.Destroy();
            FlatRedBall.SpriteManager.RemoveDrawableBatch(FlatRedBallSplashGum); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= FlatRedBallSplashGum.HandleResolutionChanged;
            FlatRedBallSplashGum = null;

            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
Ejemplo n.º 8
0
        public static void LoadStaticContent(string contentManagerName)
        {
            if (string.IsNullOrEmpty(contentManagerName))
            {
                throw new System.ArgumentException("contentManagerName cannot be empty or null");
            }
            // Set the content manager for Gum
            var contentManagerWrapper = new FlatRedBall.Gum.ContentManagerWrapper();

            contentManagerWrapper.ContentManagerName = contentManagerName;
            RenderingLibrary.Content.LoaderManager.Self.ContentLoader = contentManagerWrapper;
            // Access the GumProject just in case it's async loaded
            var throwaway = GlobalContent.GumProject;

            #if DEBUG
            if (contentManagerName == FlatRedBall.FlatRedBallServices.GlobalContentManager)
            {
                HasBeenLoadedWithGlobalContentManager = true;
            }
            else if (HasBeenLoadedWithGlobalContentManager)
            {
                throw new System.Exception("This type has been loaded with a Global content manager, then loaded with a non-global.  This can lead to a lot of bugs");
            }
            #endif
            Gum.Wireframe.GraphicalUiElement.IsAllLayoutSuspended = true;  EndingScreenGum = new FlatRedBall.Gum.GumIdb();  EndingScreenGum.LoadFromFile("content/gumproject/screens/endingscreengum.gusx");  EndingScreenGum.AssignReferences(); Gum.Wireframe.GraphicalUiElement.IsAllLayoutSuspended = false; EndingScreenGum.Element.UpdateLayout(); EndingScreenGum.Element.UpdateLayout();
            if (EndingText == null)
            {
                {
                    // We put the { and } to limit the scope of oldDelimiter
                    char oldDelimiter = FlatRedBall.IO.Csv.CsvFileManager.Delimiter;
                    FlatRedBall.IO.Csv.CsvFileManager.Delimiter = ',';
                    System.Collections.Generic.Dictionary <string, AbbatoirIntergrade.DataTypes.EndingText> temporaryCsvObject = new System.Collections.Generic.Dictionary <string, AbbatoirIntergrade.DataTypes.EndingText>();
                    FlatRedBall.IO.Csv.CsvFileManager.CsvDeserializeDictionary <string, AbbatoirIntergrade.DataTypes.EndingText>("content/screens/endingscreen/endingtext.csv", temporaryCsvObject);
                    FlatRedBall.IO.Csv.CsvFileManager.Delimiter = oldDelimiter;
                    EndingText = temporaryCsvObject;
                }
            }
            negative = FlatRedBall.FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/screens/endingscreen/negative.png", contentManagerName);
            neutral  = FlatRedBall.FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/screens/endingscreen/neutral.png", contentManagerName);
            positive = FlatRedBall.FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/screens/endingscreen/positive.png", contentManagerName);
            if (EndingCredits == null)
            {
                {
                    // We put the { and } to limit the scope of oldDelimiter
                    char oldDelimiter = FlatRedBall.IO.Csv.CsvFileManager.Delimiter;
                    FlatRedBall.IO.Csv.CsvFileManager.Delimiter = ',';
                    System.Collections.Generic.Dictionary <string, AbbatoirIntergrade.DataTypes.EndingCredits> temporaryCsvObject = new System.Collections.Generic.Dictionary <string, AbbatoirIntergrade.DataTypes.EndingCredits>();
                    FlatRedBall.IO.Csv.CsvFileManager.CsvDeserializeDictionary <string, AbbatoirIntergrade.DataTypes.EndingCredits>("content/screens/endingscreen/endingcredits.csv", temporaryCsvObject);
                    FlatRedBall.IO.Csv.CsvFileManager.Delimiter = oldDelimiter;
                    EndingCredits = temporaryCsvObject;
                }
            }
            CustomLoadStaticContent(contentManagerName);
        }
Ejemplo n.º 9
0
        public override void Destroy()
        {
            base.Destroy();
            FlatRedBall.SpriteManager.RemoveDrawableBatch(MainMenuGum); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= MainMenuGum.HandleResolutionChanged;
            MainMenuGum = null;

            if (ButtonInstance != null)
            {
                ButtonInstance.RemoveFromManagers();
            }
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
Ejemplo n.º 10
0
        public override void Initialize(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            gumIdb = new FlatRedBall.Gum.GumIdb();


            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
Ejemplo n.º 11
0
        public override void Destroy()
        {
            base.Destroy();
            FlatRedBall.SpriteManager.RemoveDrawableBatch(MemoryGameGum); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= MemoryGameGum.HandleResolutionChanged;
            MemoryGameGum = null;

            if (CardContainer != null)
            {
                CardContainer.RemoveFromManagers();
            }
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
Ejemplo n.º 12
0
        public override void Destroy()
        {
            base.Destroy();
            FlatRedBall.SpriteManager.RemoveDrawableBatch(ShooGameGum); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= ShooGameGum.HandleResolutionChanged;
            ShooGameGum = null;

            if (BroomInstance != null)
            {
                BroomInstance.Destroy();
                BroomInstance.Detach();
            }
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
Ejemplo n.º 13
0
        public override void Destroy()
        {
            base.Destroy();
            FlatRedBall.SpriteManager.RemoveDrawableBatch(LoadingScreenGum); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= LoadingScreenGum.HandleResolutionChanged;
            LoadingScreenGum = null;

            if (LoadingScreenGumRuntime != null)
            {
                LoadingScreenGumRuntime.RemoveFromManagers();
            }
            FlatRedBall.FlatRedBallServices.Game.TargetElapsedTime = TimeSpan.FromSeconds(mSavedTargetElapedTime);
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
Ejemplo n.º 14
0
        public void MoveToFrbLayer(FlatRedBall.Graphics.Layer layer, FlatRedBall.Gum.GumIdb containingScreen)
        {
            var gumLayer = containingScreen.GumLayersOnFrbLayer(layer).FirstOrDefault();

            if (gumLayer != null)
            {
                this.MoveToLayer(gumLayer);
            }
#if DEBUG
            else
            {
                throw new Exception("There is no associated Gum layer for the FRB Layer " + layer);
            }
#endif
        }
Ejemplo n.º 15
0
        public override void Destroy()
        {
            base.Destroy();
            FlatRedBall.SpriteManager.RemoveDrawableBatch(GameOverGum); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= GameOverGum.HandleResolutionChanged;
            GameOverGum = null;

            if (FinalScoreValue != null)
            {
                FinalScoreValue.RemoveFromManagers();
            }
            if (PlayAgainButton != null)
            {
                PlayAgainButton.RemoveFromManagers();
            }
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
Ejemplo n.º 16
0
        public override void Initialize(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            SpriteInstance      = new FlatRedBall.Sprite();
            SpriteInstance.Name = "SpriteInstance";
            ButtonLeave         = new Pirates.Entities.UI.Button(ContentManagerName, false);
            ButtonLeave.Name    = "ButtonLeave";
            gumIdb = new FlatRedBall.Gum.GumIdb();


            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
Ejemplo n.º 17
0
        public override void Initialize(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            Map = Level1File;

            gumIdb = new FlatRedBall.Gum.GumIdb();
            //The NamedObject FlatRedBall.TileCollisions.TileShapeCollection TileLayer1 in Screens\Level1 (Screen) has a SourceType of File, so it may not instantiate properly. If you are experiencing a NullReferenceException, consider changing theSourceType to FlatRedBallType
            // normally we wait to set variables until after the object is created, but in this case if the
            // TileShapeCollection doesn't have its Visible set before creating the tiles, it can result in
            // really bad performance issues, as shapes will be made visible, then invisible. Really bad perf!
            if (TileLayer1 != null)
            {
                TileLayer1.Visible = false;
            }


            base.Initialize(addToManagers);
        }
        public void MoveToFrbLayer(FlatRedBall.Graphics.Layer layer, FlatRedBall.Gum.GumIdb containingScreen)
        {
            var gumLayer = containingScreen.GumLayersOnFrbLayer(layer).FirstOrDefault();



#if DEBUG
            if (gumLayer == null)
            {
                string message = "There is no associated Gum layer for the FRB Layer " + layer + ".\n" +
                                 "To fix this, either add the Layer to Glue, or call AddGumLayerToFrbLayer on the GumIdb with " +
                                 "a new instance of a Gum layer. To see an example of how to use AddGumLayerToFrbLayer, add a FRB Layer to Glue and look at generated code.";
                throw new Exception(message);
            }
#endif

            MoveToFrbLayer(layer, gumLayer);
        }
Ejemplo n.º 19
0
        public override void Destroy()
        {
            base.Destroy();
            Factories.TankFactory.Destroy();
            Factories.BulletFactory.Destroy();
            Factories.TreadEffectFactory.Destroy();
            TestLevel.Destroy();
            TestLevel = null;
            FlatRedBall.SpriteManager.RemoveDrawableBatch(GameScreenGum); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= GameScreenGum.HandleResolutionChanged;
            GameScreenGum = null;

            TankList.MakeOneWay();
            BulletList.MakeOneWay();
            TreadEffects.MakeOneWay();
            for (int i = TankList.Count - 1; i > -1; i--)
            {
                TankList[i].Destroy();
            }
            for (int i = BulletList.Count - 1; i > -1; i--)
            {
                BulletList[i].Destroy();
            }
            if (CameraEntityInstance != null)
            {
                CameraEntityInstance.Destroy();
                CameraEntityInstance.Detach();
            }
            for (int i = TreadEffects.Count - 1; i > -1; i--)
            {
                TreadEffects[i].Destroy();
            }
            if (PlayerSelectionUIInstance != null)
            {
                PlayerSelectionUIInstance.RemoveFromManagers();
            }
            TankList.MakeTwoWay();
            BulletList.MakeTwoWay();
            TreadEffects.MakeTwoWay();
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
Ejemplo n.º 20
0
        public override void Destroy()
        {
            base.Destroy();
            empty_building = null;
            AbbatoirIntergradeAnimation = null;
            AbbatoirIntergradeText      = null;
            blue_eye = null;
            FlatRedBall.SpriteManager.RemoveDrawableBatch(MainMenuGum); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= MainMenuGum.HandleResolutionChanged;
            MainMenuGum = null;

            if (TheSpriteInstance != null)
            {
                FlatRedBall.SpriteManager.RemoveSprite(TheSpriteInstance);
            }
            if (ASpriteInstance != null)
            {
                FlatRedBall.SpriteManager.RemoveSprite(ASpriteInstance);
            }
            if (BbatoirSpriteInstance != null)
            {
                FlatRedBall.SpriteManager.RemoveSprite(BbatoirSpriteInstance);
            }
            if (ISpriteInstance != null)
            {
                FlatRedBall.SpriteManager.RemoveSprite(ISpriteInstance);
            }
            if (NtergradeSpriteInstance != null)
            {
                FlatRedBall.SpriteManager.RemoveSprite(NtergradeSpriteInstance);
            }
            if (MainMenuGumRuntime != null)
            {
                MainMenuGumRuntime.RemoveFromManagers();
            }
            if (LeftEye != null)
            {
                LeftEye.RemoveFromManagers();
            }
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
Ejemplo n.º 21
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();
        }
Ejemplo n.º 22
0
        public override void Destroy()
        {
            base.Destroy();
            FlatRedBall.SpriteManager.RemoveDrawableBatch(MiniGameBaseGum); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= MiniGameBaseGum.HandleResolutionChanged;
            MiniGameBaseGum = null;

            if (TimerValue != null)
            {
                TimerValue.RemoveFromManagers();
            }
            if (InstructionsTimeLeftText != null)
            {
                InstructionsTimeLeftText.RemoveFromManagers();
            }
            if (InstructionsDisplayedText != null)
            {
                InstructionsDisplayedText.RemoveFromManagers();
            }
            if (GameTimeLeft != null)
            {
                GameTimeLeft.RemoveFromManagers();
            }
            if (ButtonInstance != null)
            {
                ButtonInstance.RemoveFromManagers();
            }
            if (MiniGameBaseGumRuntime != null)
            {
                MiniGameBaseGumRuntime.RemoveFromManagers();
            }
            if (ContentBlocker != null)
            {
                ContentBlocker.RemoveFromManagers();
            }
            FlatRedBall.Math.Collision.CollisionManager.Self.Relationships.Clear();
            CustomDestroy();
        }
Ejemplo n.º 23
0
        public override void Destroy()
        {
            base.Destroy();
            Factories.BulletFactory.Destroy();
            FlatRedBall.SpriteManager.RemoveDrawableBatch(SpaceInvadersGum); FlatRedBall.FlatRedBallServices.GraphicsOptions.SizeOrOrientationChanged -= SpaceInvadersGum.HandleResolutionChanged;
            SpaceInvadersGum = null;

            BulletList.MakeOneWay();
            AlienList.MakeOneWay();
            if (PlayerShipInstance != null)
            {
                PlayerShipInstance.Destroy();
                PlayerShipInstance.Detach();
            }
            for (int i = BulletList.Count - 1; i > -1; i--)
            {
                BulletList[i].Destroy();
            }
            for (int i = AlienList.Count - 1; i > -1; i--)
            {
                AlienList[i].Destroy();
            }
            if (RightGuardRail != null)
            {
                RightGuardRail.Destroy();
                RightGuardRail.Detach();
            }
            if (LeftGuardRail != null)
            {
                LeftGuardRail.Destroy();
                LeftGuardRail.Detach();
            }
            BulletList.MakeTwoWay();
            AlienList.MakeTwoWay();
            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();
        }