예제 #1
0
        private void Collision_Ship_Mineral(object sender, CollisionEndEventArgs e)
        {
            // They all return 0's
            //Point3D contactPoint = e.ContactPositionWorld;
            //Vector3D contactNormal = e.ContactNormalWorld;
            //Vector3D contactForce = e.ContactForceWorld;


            Ship    ship    = null;
            Mineral mineral = null;

            if (e.Body1 is Ship)
            {
                ship    = (Ship)e.Body1;
                mineral = (Mineral)e.Body2;
            }
            else
            {
                ship    = (Ship)e.Body2;
                mineral = (Mineral)e.Body1;
            }

            if (ship.CollideWithMineral(mineral))
            {
                // The ship is taking the mineral
                e.AllowCollision = false;
                _map.RemoveItem(mineral);
            }
        }
예제 #2
0
        private void Collision_Ship_Asteroid(object sender, CollisionEndEventArgs e)
        {
            Ship     ship     = null;
            Asteroid asteroid = null;

            if (e.Body1 is Ship)
            {
                ship     = (Ship)e.Body1;
                asteroid = (Asteroid)e.Body2;
            }
            else
            {
                ship     = (Ship)e.Body2;
                asteroid = (Asteroid)e.Body1;
            }

            ship.CollideWithAsteroid(asteroid, e);
        }
예제 #3
0
 public void CollideWithAsteroid(Asteroid asteroid, CollisionEndEventArgs e)
 {
     // Figure out the impulse
 }