Esempio n. 1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            playerBall.UpdateCore(gameTime);
            collisionManager.Update(gameTime);
            bubbleManager.Update(gameTime);

            // var bubbles = bubbleManager.Bubbles;
            // check if the player has touched any enemies, if hit the enemies disappear
            for (int i = 0; i < bubbleManager.Bubbles.Count; i++)
            {
                var bubble = bubbleManager.Bubbles[i];
                if (bubble.IsHit)
                {
                    bubbleManager.Pop(bubble);
                    collisionManager.RemoveCollidable(bubble);
                }
                //if (bubble.HasHitWall)
                //{
                //  var newBubble = bubbleManager.MakeBubble(bubble.Color);
                //  collisionManager.AddCollidable(newBubble);
                //  bubble.HasHitWall = false;
                //  newBubble.HasHitWall = false;
                //}
            }
        }