Ejemplo n.º 1
0
        }//end update

        void CheckForShotHits()
        {
            //loop through objects and find shots
            for (int i = 0; i < objects.Count; i++)
            {
                if (objects[i] is PlayerShot)
                {
                    //loop through objects and find asteroids
                    for (int j = 0; j < objects.Count; j++)
                    {
                        //is it an asteroid
                        if (objects[j] is Asteroid)
                        {
                            Asteroid a = objects[j] as Asteroid;

                            //is the distance to the shot < 10
                            if (a.GetDistance(objects[i]) < a.Radius)
                            {
                                objects[i].Destroy = true;

                                ((Asteroid)objects[j]).Hit(objects);

                                break;
                            }
                        }
                    }
                }
            }
        }