Exemple #1
0
        public override void Update(GameTime gameTime)
        {
            float dTime = (float)gameTime.ElapsedGameTime.TotalMilliseconds / 1000;

            if (Game1.GameStatus == GameState.Playing)
            {
                foreach (Paddle pad in paddle)
                {
                    for (int i = items.Count() - 1; i >= 0; i--)
                    {
                        IItem item = items[i];
                        item.UpdateItem(dTime);

                        if (item.PerPixelCollision(pad))
                        {
                            item.TriggerEffect();
                            items.RemoveAt(i);
                        }
                        else if (!items[i].IsOnScreen())
                        {
                            item.DestroyEffect();
                            items.RemoveAt(i);
                        }
                    }
                }
            }
            base.Update(gameTime);
        }