Example #1
0
        //constructor
        public Enemy(Texture2D texture, int health, AttackPattern ap, List <ShotPattern> sp_list, int fireCount, float fireRate)
        {
            m_image         = texture;
            m_curHealth     = health;
            m_points        = health * 10;
            m_attackPattern = ap;
            m_shotPatterns  = sp_list;
            m_fireCount     = fireCount;
            m_fireRate      = fireRate;

            m_textureData = new Color[m_image.Width * m_image.Height];
            m_image.GetData(m_textureData);
            m_pos.X = m_attackPattern.m_startX;
            m_pos.Y = m_attackPattern.m_startY;

            m_center.X = m_pos.X + m_image.Width / 2;
            m_center.Y = m_pos.Y + m_image.Height / 2;

            m_exitPos = new Vector2(m_attackPattern.m_endX, m_attackPattern.m_endY);
            SetFireRate();
        }
Example #2
0
        //constructor
        public Enemy(Texture2D texture, int health, AttackPattern ap, List<ShotPattern> sp_list, int fireCount, float fireRate)
        {
            m_image = texture;
            m_curHealth = health;
            m_points = health * 10;
            m_attackPattern = ap;
            m_shotPatterns = sp_list;
            m_fireCount = fireCount;
            m_fireRate = fireRate;

            m_textureData = new Color[m_image.Width * m_image.Height];
            m_image.GetData(m_textureData);
            m_pos.X = m_attackPattern.m_startX;
            m_pos.Y = m_attackPattern.m_startY;

            m_center.X = m_pos.X + m_image.Width / 2;
            m_center.Y = m_pos.Y + m_image.Height / 2;

            m_exitPos = new Vector2(m_attackPattern.m_endX, m_attackPattern.m_endY);
            SetFireRate();
        }
Example #3
0
        private void LoadGameLevel(int level)
        {
            XmlDocument xml = new XmlDocument();
            xml.Load("D:\\VS 2010 Projects\\Shooter\\Shooter\\ShooterContent\\Levels\\" + level.ToString() + ".xml");
            XmlNode root = xml.FirstChild;
            XmlNode waveNode;
            XmlNode formationNode;
            XmlNode enemyNode;
            XmlAttributeCollection attributes;

            Level = new Level();				//level contains list of waves
            Wave nextWave;						//wave contains list of formations
            Formation nextFormation;			//formation contains list of enemies
            Enemy nextEnemy;					//enemies will die horrible deaths
            AttackPattern nextAttackPattern;	//attackPattern defines enemy movement between start and end positions
            ShotPattern nextShotPattern;		//defines enemy bullets per shot and how those bullets move
            Texture2D shotImage;				//duh

            float waveDuration = 0;
            float formationTrigger = 0;

            string attackPatternID = "";	//name identifier for AttackPattern
            string shotPatternID = "";		//name identifier for ShotPattern
            string enemyType = "";			//tells which texture will be drawn for enemy
            string enemyShot = "";			//tells which texture will be drawn for enemy shot
            float enemyHealth = 0;			//duh
            float startX = 0;				//Start and End positions the enemy ship will use
            float startY = 0;
            float endX = 0;
            float endY = 0;
            int fireCount = 0;				//number of times the enemy will fire it's shotPattern
            float fireRate = 0;				//how frequently the enemy will fire another shotPattern
            int shotSpeed = 0;				//how fast each shot will move

            List<ShotPattern> shotPatterns;	//list of shotPatterns that will be passed to enemy
            int count = 0;					//counter for adding ShotPatterns

            if (root.HasChildNodes)
            {
                for (int i = 0; i < root.ChildNodes.Count; i++)	//waves
                {
                    waveNode = root.ChildNodes[i];
                    attributes = waveNode.Attributes;
                    waveDuration = Convert.ToSingle(attributes.GetNamedItem("d").Value);
                    nextWave = new Wave(waveDuration);	//Create new wave

                    if (waveNode.HasChildNodes)
                    {
                        for (int j = 0; j < waveNode.ChildNodes.Count; j++)	//formations
                        {
                            formationNode = waveNode.ChildNodes[j];
                            attributes = formationNode.Attributes;
                            formationTrigger = Convert.ToSingle(attributes.GetNamedItem("d").Value);

                            nextFormation = new Formation(formationTrigger);
                            if (formationNode.HasChildNodes)
                            {
                                for (int k = 0; k < formationNode.ChildNodes.Count; k++)	//enemies
                                {
                                    enemyNode = formationNode.ChildNodes[k];
                                    attributes = enemyNode.Attributes;
                                    enemyType = attributes.GetNamedItem("type").Value;
                                    enemyShot = attributes.GetNamedItem("shot").Value;
                                    try
                                    {
                                        enemyHealth = Convert.ToInt32(attributes.GetNamedItem("health").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Health: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Health: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        startX = Convert.ToInt32(attributes.GetNamedItem("startX").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Starting X: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Starting X: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        startY = Convert.ToInt32(attributes.GetNamedItem("startY").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Starting Y: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Starting Y: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        endX = Convert.ToInt32(attributes.GetNamedItem("endX").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Starting X: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Starting X: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        endY = Convert.ToInt32(attributes.GetNamedItem("endY").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Starting Y: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Starting Y: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        shotSpeed = Convert.ToInt32(attributes.GetNamedItem("shotSpeed").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Shot Speed: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Shot Speed: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        fireCount = Convert.ToInt32(attributes.GetNamedItem("fireCount").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Shot Freqency: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Shot Freqency: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        fireRate = Convert.ToSingle(attributes.GetNamedItem("fireRate").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Shot Freqency: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Shot Freqency: The number cannot fit in a float.");
                                    }

                                    //enemy attack pattern
                                    nextAttackPattern = new AttackPattern();
                                    attackPatternID = attributes.GetNamedItem("ap").Value;
                                    nextAttackPattern.SetID(attackPatternID);
                                    nextAttackPattern.SetEndPosition(endX, endY);
                                    nextAttackPattern.SetStartPosition(startX, startY);

                                    if ((nextAttackPattern = PopulateAttackPattern(nextAttackPattern)) == null)			//Load AttackPattern moveList
                                    {
                                        Console.WriteLine("Failed to load attack pattern " + attackPatternID.ToString());
                                    }

                                    //enemy shot pattern

                                    shotPatternID = attributes.GetNamedItem("sp").Value;
                                    shotPatterns = new List<ShotPattern>();		//only one shotPattern List per enemy, so new outside while loop
                                    count = 0;
                                    while (count < fireCount)
                                    {
                                        nextShotPattern = new ShotPattern(shotPatternID, shotSpeed);		//we potentially want multiple ShotPattern objects per enemy, so new in while loop
                                        shotImage = this.Content.Load<Texture2D>(enemyShot);

                                        //Create the appropriate number of shotPatterns for the enemy

                                        if ((nextShotPattern = PopulateShotPattern(nextShotPattern, shotImage)) == null)			//populate ShotPattern's shotList
                                        {
                                            Console.WriteLine("Failed to load shot pattern " + shotPatternID.ToString());
                                        }
                                        shotPatterns.Add(nextShotPattern);
                                        count++;
                                    }

                                    //ContentManager should only load textures if they aren't already cached
                                    nextEnemy = new Enemy(this.Content.Load<Texture2D>(enemyType), Convert.ToInt32(enemyHealth), nextAttackPattern, shotPatterns, fireCount, fireRate);
                                    LevelEnemies.Add(nextEnemy);
                                    nextFormation.AddEnemy(nextEnemy);
                                }

                                nextWave.AddFormation(nextFormation);
                            }
                            else
                            {
                                Console.WriteLine("Empty formation found");
                            }
                        }

                        Level.AddWave(nextWave);
                    }
                    else
                    {
                        Console.WriteLine("Empty wave found");
                    }
                }
            }
            else
            {
                Console.WriteLine("root node: no children found");
            }
        }
Example #4
0
        public AttackPattern PopulateAttackPattern(AttackPattern pattern)
        {
            XmlDocument xml = new XmlDocument();
            xml.Load("D:\\VS 2010 Projects\\Shooter\\Shooter\\ShooterContent\\AttackPatterns\\" + pattern.m_id + ".xml");
            XmlNode root = xml.FirstChild;
            XmlNode child;
            XmlAttributeCollection attributes;

            float endX = 0;
            float endY = 0;

            float moveX = 0;
            float moveY = 0;
            float speedX = 0;
            float speedY = 0;
            float waitTime = 0;

            float exitSpeed = 0;
            if (root == null)
            {
                return null;
            }

            attributes = root.Attributes;
            try
            {
                exitSpeed = Convert.ToInt32(attributes.GetNamedItem("exitSpeed").Value);
            }
            catch (FormatException e)
            {
                Console.WriteLine("AttackPattern exitSpeed: Input string is not a sequence of digits.");
            }
            catch (OverflowException e)
            {
                Console.WriteLine("AttackPattern exitSpeed: The number cannot fit in a float.");
            }

            pattern.SetExitSpeed(exitSpeed);
            if (root.HasChildNodes)
            {
                for (int j = 0; j < root.ChildNodes.Count; j++)
                {
                    child = root.ChildNodes[j];
                    attributes = child.Attributes;
                    try
                    {
                        moveX = Convert.ToInt32(attributes.GetNamedItem("moveX").Value);
                    }
                    catch (FormatException e)
                    {
                        Console.WriteLine("AttackPattern moveX: Input string is not a sequence of digits.");
                    }
                    catch (OverflowException e)
                    {
                        Console.WriteLine("AttackPattern moveX: The number cannot fit in a float.");
                    }

                    try
                    {
                        moveY = Convert.ToInt32(attributes.GetNamedItem("moveY").Value);
                    }
                    catch (FormatException e)
                    {
                        Console.WriteLine("AttackPattern moveY: Input string is not a sequence of digits.");
                    }
                    catch (OverflowException e)
                    {
                        Console.WriteLine("AttackPattern moveY: The number cannot fit in a float.");
                    }

                    try
                    {
                        speedX = Convert.ToInt32(attributes.GetNamedItem("speedX").Value);
                    }
                    catch (FormatException e)
                    {
                        Console.WriteLine("AttackPattern speedX: Input string is not a sequence of digits.");
                    }
                    catch (OverflowException e)
                    {
                        Console.WriteLine("AttackPattern speedX: The number cannot fit in a float.");
                    }

                    try
                    {
                        speedY = Convert.ToInt32(attributes.GetNamedItem("speedY").Value);
                    }
                    catch (FormatException e)
                    {
                        Console.WriteLine("AttackPattern speedY: Input string is not a sequence of digits.");
                    }
                    catch (OverflowException e)
                    {
                        Console.WriteLine("AttackPattern speedY: The number cannot fit in a float.");
                    }

                    try
                    {
                        waitTime = Convert.ToSingle(attributes.GetNamedItem("wait").Value);
                    }
                    catch (FormatException e)
                    {
                        Console.WriteLine("AttackPattern wait: Input string is not a sequence of digits.");
                    }
                    catch (OverflowException e)
                    {
                        Console.WriteLine("AttackPattern wait: The number cannot fit in a float.");
                    }

                    pattern.AddManuver(pattern.m_startX + moveX, pattern.m_startY + moveY, speedX, speedY, waitTime);
                }
            }
            else
            {
                Console.WriteLine("AttackPattern root: could not find children");
            }
            return pattern;
        }
Example #5
0
        public AttackPattern PopulateAttackPattern(AttackPattern pattern)
        {
            XmlDocument xml = new XmlDocument();

            xml.Load("D:\\VS 2010 Projects\\Shooter\\Shooter\\ShooterContent\\AttackPatterns\\" + pattern.m_id + ".xml");
            XmlNode root = xml.FirstChild;
            XmlNode child;
            XmlAttributeCollection attributes;

            float endX = 0;
            float endY = 0;

            float moveX    = 0;
            float moveY    = 0;
            float speedX   = 0;
            float speedY   = 0;
            float waitTime = 0;

            float exitSpeed = 0;

            if (root == null)
            {
                return(null);
            }

            attributes = root.Attributes;
            try
            {
                exitSpeed = Convert.ToInt32(attributes.GetNamedItem("exitSpeed").Value);
            }
            catch (FormatException e)
            {
                Console.WriteLine("AttackPattern exitSpeed: Input string is not a sequence of digits.");
            }
            catch (OverflowException e)
            {
                Console.WriteLine("AttackPattern exitSpeed: The number cannot fit in a float.");
            }

            pattern.SetExitSpeed(exitSpeed);
            if (root.HasChildNodes)
            {
                for (int j = 0; j < root.ChildNodes.Count; j++)
                {
                    child      = root.ChildNodes[j];
                    attributes = child.Attributes;
                    try
                    {
                        moveX = Convert.ToInt32(attributes.GetNamedItem("moveX").Value);
                    }
                    catch (FormatException e)
                    {
                        Console.WriteLine("AttackPattern moveX: Input string is not a sequence of digits.");
                    }
                    catch (OverflowException e)
                    {
                        Console.WriteLine("AttackPattern moveX: The number cannot fit in a float.");
                    }

                    try
                    {
                        moveY = Convert.ToInt32(attributes.GetNamedItem("moveY").Value);
                    }
                    catch (FormatException e)
                    {
                        Console.WriteLine("AttackPattern moveY: Input string is not a sequence of digits.");
                    }
                    catch (OverflowException e)
                    {
                        Console.WriteLine("AttackPattern moveY: The number cannot fit in a float.");
                    }

                    try
                    {
                        speedX = Convert.ToInt32(attributes.GetNamedItem("speedX").Value);
                    }
                    catch (FormatException e)
                    {
                        Console.WriteLine("AttackPattern speedX: Input string is not a sequence of digits.");
                    }
                    catch (OverflowException e)
                    {
                        Console.WriteLine("AttackPattern speedX: The number cannot fit in a float.");
                    }

                    try
                    {
                        speedY = Convert.ToInt32(attributes.GetNamedItem("speedY").Value);
                    }
                    catch (FormatException e)
                    {
                        Console.WriteLine("AttackPattern speedY: Input string is not a sequence of digits.");
                    }
                    catch (OverflowException e)
                    {
                        Console.WriteLine("AttackPattern speedY: The number cannot fit in a float.");
                    }

                    try
                    {
                        waitTime = Convert.ToSingle(attributes.GetNamedItem("wait").Value);
                    }
                    catch (FormatException e)
                    {
                        Console.WriteLine("AttackPattern wait: Input string is not a sequence of digits.");
                    }
                    catch (OverflowException e)
                    {
                        Console.WriteLine("AttackPattern wait: The number cannot fit in a float.");
                    }

                    pattern.AddManuver(pattern.m_startX + moveX, pattern.m_startY + moveY, speedX, speedY, waitTime);
                }
            }
            else
            {
                Console.WriteLine("AttackPattern root: could not find children");
            }
            return(pattern);
        }
Example #6
0
        private void LoadGameLevel(int level)
        {
            XmlDocument xml = new XmlDocument();

            xml.Load("D:\\VS 2010 Projects\\Shooter\\Shooter\\ShooterContent\\Levels\\" + level.ToString() + ".xml");
            XmlNode root = xml.FirstChild;
            XmlNode waveNode;
            XmlNode formationNode;
            XmlNode enemyNode;
            XmlAttributeCollection attributes;

            Level = new Level();                                //level contains list of waves
            Wave          nextWave;                             //wave contains list of formations
            Formation     nextFormation;                        //formation contains list of enemies
            Enemy         nextEnemy;                            //enemies will die horrible deaths
            AttackPattern nextAttackPattern;                    //attackPattern defines enemy movement between start and end positions
            ShotPattern   nextShotPattern;                      //defines enemy bullets per shot and how those bullets move
            Texture2D     shotImage;                            //duh

            float waveDuration     = 0;
            float formationTrigger = 0;

            string attackPatternID = "";                //name identifier for AttackPattern
            string shotPatternID   = "";                //name identifier for ShotPattern
            string enemyType       = "";                //tells which texture will be drawn for enemy
            string enemyShot       = "";                //tells which texture will be drawn for enemy shot
            float  enemyHealth     = 0;                 //duh
            float  startX          = 0;                 //Start and End positions the enemy ship will use
            float  startY          = 0;
            float  endX            = 0;
            float  endY            = 0;
            int    fireCount       = 0;                 //number of times the enemy will fire it's shotPattern
            float  fireRate        = 0;                 //how frequently the enemy will fire another shotPattern
            int    shotSpeed       = 0;                 //how fast each shot will move

            List <ShotPattern> shotPatterns;            //list of shotPatterns that will be passed to enemy
            int count = 0;                              //counter for adding ShotPatterns

            if (root.HasChildNodes)
            {
                for (int i = 0; i < root.ChildNodes.Count; i++)                 //waves
                {
                    waveNode     = root.ChildNodes[i];
                    attributes   = waveNode.Attributes;
                    waveDuration = Convert.ToSingle(attributes.GetNamedItem("d").Value);
                    nextWave     = new Wave(waveDuration);                      //Create new wave

                    if (waveNode.HasChildNodes)
                    {
                        for (int j = 0; j < waveNode.ChildNodes.Count; j++)                             //formations
                        {
                            formationNode    = waveNode.ChildNodes[j];
                            attributes       = formationNode.Attributes;
                            formationTrigger = Convert.ToSingle(attributes.GetNamedItem("d").Value);

                            nextFormation = new Formation(formationTrigger);
                            if (formationNode.HasChildNodes)
                            {
                                for (int k = 0; k < formationNode.ChildNodes.Count; k++)                                        //enemies
                                {
                                    enemyNode  = formationNode.ChildNodes[k];
                                    attributes = enemyNode.Attributes;
                                    enemyType  = attributes.GetNamedItem("type").Value;
                                    enemyShot  = attributes.GetNamedItem("shot").Value;
                                    try
                                    {
                                        enemyHealth = Convert.ToInt32(attributes.GetNamedItem("health").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Health: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Health: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        startX = Convert.ToInt32(attributes.GetNamedItem("startX").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Starting X: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Starting X: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        startY = Convert.ToInt32(attributes.GetNamedItem("startY").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Starting Y: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Starting Y: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        endX = Convert.ToInt32(attributes.GetNamedItem("endX").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Starting X: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Starting X: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        endY = Convert.ToInt32(attributes.GetNamedItem("endY").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Starting Y: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Starting Y: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        shotSpeed = Convert.ToInt32(attributes.GetNamedItem("shotSpeed").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Shot Speed: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Shot Speed: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        fireCount = Convert.ToInt32(attributes.GetNamedItem("fireCount").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Shot Freqency: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Shot Freqency: The number cannot fit in an Int32.");
                                    }

                                    try
                                    {
                                        fireRate = Convert.ToSingle(attributes.GetNamedItem("fireRate").Value);
                                    }
                                    catch (FormatException e)
                                    {
                                        Console.WriteLine("Enemy Shot Freqency: Input string is not a sequence of digits.");
                                    }
                                    catch (OverflowException e)
                                    {
                                        Console.WriteLine("Enemy Shot Freqency: The number cannot fit in a float.");
                                    }

                                    //enemy attack pattern
                                    nextAttackPattern = new AttackPattern();
                                    attackPatternID   = attributes.GetNamedItem("ap").Value;
                                    nextAttackPattern.SetID(attackPatternID);
                                    nextAttackPattern.SetEndPosition(endX, endY);
                                    nextAttackPattern.SetStartPosition(startX, startY);

                                    if ((nextAttackPattern = PopulateAttackPattern(nextAttackPattern)) == null)                                                         //Load AttackPattern moveList
                                    {
                                        Console.WriteLine("Failed to load attack pattern " + attackPatternID.ToString());
                                    }

                                    //enemy shot pattern

                                    shotPatternID = attributes.GetNamedItem("sp").Value;
                                    shotPatterns  = new List <ShotPattern>();                                           //only one shotPattern List per enemy, so new outside while loop
                                    count         = 0;
                                    while (count < fireCount)
                                    {
                                        nextShotPattern = new ShotPattern(shotPatternID, shotSpeed);                                                    //we potentially want multiple ShotPattern objects per enemy, so new in while loop
                                        shotImage       = this.Content.Load <Texture2D>(enemyShot);

                                        //Create the appropriate number of shotPatterns for the enemy

                                        if ((nextShotPattern = PopulateShotPattern(nextShotPattern, shotImage)) == null)                                                                //populate ShotPattern's shotList
                                        {
                                            Console.WriteLine("Failed to load shot pattern " + shotPatternID.ToString());
                                        }
                                        shotPatterns.Add(nextShotPattern);
                                        count++;
                                    }

                                    //ContentManager should only load textures if they aren't already cached
                                    nextEnemy = new Enemy(this.Content.Load <Texture2D>(enemyType), Convert.ToInt32(enemyHealth), nextAttackPattern, shotPatterns, fireCount, fireRate);
                                    LevelEnemies.Add(nextEnemy);
                                    nextFormation.AddEnemy(nextEnemy);
                                }

                                nextWave.AddFormation(nextFormation);
                            }
                            else
                            {
                                Console.WriteLine("Empty formation found");
                            }
                        }

                        Level.AddWave(nextWave);
                    }
                    else
                    {
                        Console.WriteLine("Empty wave found");
                    }
                }
            }
            else
            {
                Console.WriteLine("root node: no children found");
            }
        }