Ejemplo n.º 1
0
        /// <summary>
        /// Update all of the bullets held in the list.
        /// Add the ones that are still alive to a new list.
        /// </summary>
        /// <param name="ms">Milliseconds passed since last update</param>
        public void Update(float ms)
        {
            int i = alienProjectilePool.GetFirst();

            while (i != -1)
            {
                AlienBullet b = alienProjectilePool.GetByIndex(i);
                b.Update(ms);
                if (b.MustBeDeleted())
                {
                    alienProjectilePool.Dispose(b);
                }
                i = alienProjectilePool.NextIndex(b);
            }
        }
Ejemplo n.º 2
0
        public IProjectile CheckHit(PlayerObject player)
        {
            int i = alienProjectilePool.GetFirst();

            while (i != -1)
            {
                AlienBullet b = alienProjectilePool.GetByIndex(i);
                if (Collider.Collide(player.collisionRectangle, b.GetCenter()))
                {
                    return(b);
                }
                i = alienProjectilePool.NextIndex(b);
            }

            return(null);
        }