Example #1
0
        public override void Destroy()
        {
            base.Destroy();
            BulletFactory.Destroy();
            EnemyFactory.Destroy();

            BulletList.MakeOneWay();
            EnemyList.MakeOneWay();
            if (BackgroundInstance != null)
            {
                BackgroundInstance.Destroy();
                BackgroundInstance.Detach();
            }
            if (PlayerInstance != null)
            {
                PlayerInstance.Destroy();
                PlayerInstance.Detach();
            }
            for (int i = BulletList.Count - 1; i > -1; i--)
            {
                BulletList[i].Destroy();
            }
            for (int i = EnemyList.Count - 1; i > -1; i--)
            {
                EnemyList[i].Destroy();
            }
            if (ScoreboardInstance != null)
            {
                ScoreboardInstance.Destroy();
                ScoreboardInstance.Detach();
            }
            BulletList.MakeTwoWay();
            EnemyList.MakeTwoWay();
            CustomDestroy();
        }
Example #2
0
        public override void Destroy()
        {
            // Generated Destroy
            BulletFactory.Destroy();
            EnemyBulletFactory.Destroy();
            if (mStartLevel != null)
            {
                mStartLevel.Destroy();
                mStartLevel = null;
            }
            if (mLevel2 != null)
            {
                mLevel2.Destroy();
                mLevel2 = null;
            }
            if (mLevel3 != null)
            {
                mLevel3.Destroy();
                mLevel3 = null;
            }
            if (mLevel4 != null)
            {
                mLevel4.Destroy();
                mLevel4 = null;
            }
            if (mEndLevel != null)
            {
                mEndLevel.Destroy();
                mEndLevel = null;
            }

            BulletList.MakeOneWay();
            NextLevelEntityList.MakeOneWay();
            SignEntityList.MakeOneWay();
            ActionEntityList.MakeOneWay();
            EnemyBulletList.MakeOneWay();
            EnemyCornerList.MakeOneWay();
            GroundEnemyList.MakeOneWay();
            if (TiledMap != null)
            {
                TiledMap.Destroy();
            }
            if (TileCollisionShapes != null)
            {
                TileCollisionShapes.RemoveFromManagers(ContentManagerName != "Global");
            }
            for (int i = BulletList.Count - 1; i > -1; i--)
            {
                BulletList[i].Destroy();
            }
            for (int i = NextLevelEntityList.Count - 1; i > -1; i--)
            {
                NextLevelEntityList[i].Destroy();
            }
            if (PlayerInstance != null)
            {
                PlayerInstance.Destroy();
                PlayerInstance.Detach();
            }
            for (int i = SignEntityList.Count - 1; i > -1; i--)
            {
                SignEntityList[i].Destroy();
            }
            for (int i = ActionEntityList.Count - 1; i > -1; i--)
            {
                ActionEntityList[i].Destroy();
            }
            for (int i = EnemyBulletList.Count - 1; i > -1; i--)
            {
                EnemyBulletList[i].Destroy();
            }
            for (int i = EnemyCornerList.Count - 1; i > -1; i--)
            {
                EnemyCornerList[i].Destroy();
            }
            for (int i = GroundEnemyList.Count - 1; i > -1; i--)
            {
                GroundEnemyList[i].Destroy();
            }
            if (EntityCollisionShapes != null)
            {
                EntityCollisionShapes.RemoveFromManagers(ContentManagerName != "Global");
            }
            if (EnemyCollisionGround != null)
            {
                EnemyCollisionGround.RemoveFromManagers(ContentManagerName != "Global");
            }
            if (TheEndText != null)
            {
                TextManager.RemoveText(TheEndText);
            }
            BulletList.MakeTwoWay();
            NextLevelEntityList.MakeTwoWay();
            SignEntityList.MakeTwoWay();
            ActionEntityList.MakeTwoWay();
            EnemyBulletList.MakeTwoWay();
            EnemyCornerList.MakeTwoWay();
            GroundEnemyList.MakeTwoWay();

            base.Destroy();

            CustomDestroy();
        }