Esempio n. 1
0
        public void RemoveAt()
        {
            list.RemoveAt(5);
            foreach (string item in list)
            {
                item.Should().NotBe("test 5");
            }

            set.RemoveAt(5);
            foreach (string item in set)
            {
                item.Should().NotBe("test 5");
            }
        }
Esempio n. 2
0
        public override void Update(GameTime gameTime)
        {
            m_soundManager.Update(gameTime.ElapsedGameTime);

            UpdateView(gameTime);

            using (var handle = m_safeParticlesCollection.SafeRead())
            {
                for (int i = 0; i < handle.Items.Count; i++)
                {
                    if (handle.Items[i].IsGarbage)
                    {
                        m_safeParticlesCollection.RemoveAt(i);
                    }
                    else
                    {
                        handle.Items[i].Update(gameTime);
                    }
                }
            }

            using (var handle = m_safeDrawableGameComponents.SafeRead())
            {
                MyDrawableGameComponent[] copy = m_safeDrawableGameComponents.ToArray();

                for (int i = copy.Length - 1; i >= 0; i--)
                {
                    if (!copy[i].IsGarbage)
                    {
                        copy[i].Update(gameTime);
                    }
                    else
                    {
                        m_safeDrawableGameComponents.RemoveAt(i);
                    }
                }
            }
        }