Пример #1
0
        protected virtual void ProcessCollisions()
        {
            foreach (var collision in PhysicEngine.GetCollisions(m_safeGameObjects.ToArray()))
            {
                GameObject a = collision.FirstObject;
                GameObject b = collision.SecondObject;

                if (collision.CheckTypesBoth(typeof(Bullet), typeof(GameObject)))
                {
                    Bullet     bullet = a is Bullet ? (Bullet)a : (Bullet)b;
                    GameObject obj    = a is Bullet ? b : a;

                    bullet.CollideWith(obj);
                }

                if (collision.CheckTypesBoth(typeof(Bonus), typeof(Plane)))
                {
                    Bonus bonus = a is Bonus ? (Bonus)a : (Bonus)b;
                    Plane plane = a is Bonus ? (Plane)b : (Plane)a;

                    if (!plane.IsGarbage)
                    {
                        ApplyBonus(bonus, plane);
                    }
                }

                GenerateExplosionsOnCollision(collision);

                OnCollisionDetected(this, new CollisionEventArgs(collision));
            }
        }
Пример #2
0
 public void Affect(Vector force, Vector fulcrum)
 {
     PhysicEngine.Affect(this, force, fulcrum);
 }
Пример #3
0
 public void AffectImpulse(Vector impulse, Vector fulcrum)
 {
     PhysicEngine.ImpulseAffect(this, impulse, fulcrum);
 }
Пример #4
0
 public virtual void Update(TimeSpan elapsed)
 {
     //if (!IsGarbage)
     PhysicEngine.UpdateMechanicalParameters(this, elapsed);
 }