Ejemplo n.º 1
0
        /// <summary>
        /// Checks if a projectile has collided with this asteroid
        /// </summary>
        /// <param name="proj"></param>
        /// <returns></returns>
        public bool ShouldExplode(Projectile proj)
        {
            // Circle Circle Collision check
            // The distance between centers is less than sum of radii
            Vector2f difference = new Vector2f(shape.Position.X - proj.GetPostion().X, shape.Position.Y - proj.GetPostion().Y);
            float    sumRadii   = radius + proj.Radius;

            return(difference.Magnitude() <= sumRadii);
        }