Esempio n. 1
0
        internal static void DestroyShields(ShieldGroup pShieldGroup)
        {
            // Iterate through shields
            ShieldRoot pShieldRoot = (ShieldRoot)pShieldGroup.GetFirstChild();

            while (pShieldRoot != null)
            {
                // Iterate through shield columns
                ShieldColumn pShieldCol = (ShieldColumn)pShieldRoot.GetFirstChild();
                while (pShieldCol != null)
                {
                    // Iterate through shield bricks
                    ShieldBrick pShieldBrick = (ShieldBrick)pShieldCol.GetFirstChild();
                    while (pShieldBrick != null)
                    {
                        // Remove ShieldBrick from composite
                        pShieldCol.Remove(pShieldBrick);

                        // Kill ShieldRoot
                        pShieldBrick.Remove(SpriteBatch.Name.Shield, SpriteBatch.Name.CollisionBox);

                        // Get next ShieldColumn
                        pShieldBrick = (ShieldBrick)pShieldCol.GetFirstChild();
                    }

                    // Remove ShieldColumn from composite
                    pShieldRoot.Remove(pShieldCol);

                    // Kill ShieldRoot
                    pShieldCol.Remove(SpriteBatch.Name.Shield, SpriteBatch.Name.CollisionBox);

                    // Get next ShieldColumn
                    pShieldCol = (ShieldColumn)pShieldRoot.GetFirstChild();
                }


                // Remove ShieldRoot from composite
                pShieldGroup.Remove(pShieldRoot);

                // Kill ShieldRoot
                pShieldRoot.Remove(SpriteBatch.Name.Shield, SpriteBatch.Name.CollisionBox);

                // Get next ShieldRoot
                pShieldRoot = (ShieldRoot)pShieldGroup.GetFirstChild();
            }
        }