MyGame.BulletsManager.UpdateShots C# (CSharp) Method

UpdateShots() protected method

update the bullet if the bulltet out of range or collide with the monster remove it
protected UpdateShots ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime The game time
return void
        protected void UpdateShots(GameTime gameTime)
        {
            // Loop through shots
            for (int i = 0; i < bullets.Count; ++i)
            {
                // Update each shot
                bullets[i].Update(gameTime);

                 //If shot is out of bounds, remove it from game
                Vector3 pos = bullets[i].unit.position ;
                if(Math.Abs(pos.Length()) > bulletRange ||
                    myGame.checkCollisionWithBullet(bullets[i].unit) //||
                    /*pos.Y < myGame.GetHeightAtPosition(pos.X,pos.Z)*/ )
                {
                    bullets[i].Dispose();
                    bullets.RemoveAt(i);

                    --i;
                }
            }
        }