Ejemplo n.º 1
0
        private void UpdateBoons()
        {
            int boonsSize = Boons.Count;

            for (int i = 0; i < boonsSize; i++)
            {
                BoonObject curBoon = Boons.Dequeue();

                // Update the position of the current Destructible
                curBoon.Update(gameSpeed, Ship.Position, Ship.Attraction);

                bool boonCollected = curBoon.isCollected(Ship.Bounds, Ship.GrabRadius);
                if (boonCollected)
                {
                    if (EnumEquals(curBoon.type, boonTypes.money))
                    {
                        Money++;
                    }
                    if (EnumEquals(curBoon.type, boonTypes.material))
                    {
                        Material++;
                    }
                    if (EnumEquals(curBoon.type, boonTypes.bonus))
                    {
                        Bonuses++;
                    }
                }

                bool onScreen = !(curBoon.Position.Y > MaxY || boonCollected);
                if (onScreen) // If the Enemy is not past the bottom of the screen
                {
                    Boons.Enqueue(curBoon);
                }
            }
        }