Ejemplo n.º 1
0
 public override void collide(Tangible target, GameTime gameTime)
 {
     if (target is Projectile)
     {
         target.collide(this, gameTime);
     }
     else if (target is Ship)
     {
         game.collisionHandler.shipOnPlanet((Ship)target, this, gameTime);
     }
     else if (target is Asteroid)
     {
         game.collisionHandler.asteroidOnPlanet((Asteroid)target, this, gameTime);
     }
     else if (target is Planet)
     {
         game.collisionHandler.planetOnPlanet(this, (Planet)target, gameTime);
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Determine what kind of collision is occuring.
 /// @Written by Tristan.
 /// </summary>
 /// <param name="target"></param>
 /// <param name="gameTime"></param>
 /// <exception cref="NotImplementedException">A new kind of object that needs handling</exception>
 public override void collide(Tangible target, GameTime gameTime)
 {
     if (target is Projectile)
     {
         target.collide(this, gameTime);                 // the projectile can handle it from here
     }
     else if (target is Ship)
     {
         game.collisionHandler.shipOnShip(this, (Ship)target, gameTime);
     }
     else if (target is Asteroid)
     {
         game.collisionHandler.shipOnAsteroid(this, (Asteroid)target, gameTime);
     }
     else if (target is Planet)
     {
         game.collisionHandler.shipOnPlanet(this, (Planet)target, gameTime);
     }
     else
     {
         throw new NotImplementedException();
     }
 }