コード例 #1
0
        private void Collision(Bullet bullet, Ennemy ennemy)
        {
            if (ennemy.Life.IsAlive)
            {
                var vecteur = ennemy.Location.Position - bullet.Location.Position;
                var norme = Math.Sqrt(Math.Pow(vecteur.X, 2) + Math.Pow(vecteur.Y, 2));

                if (norme < 15)
                {
                    ennemy.Life.TakeDamage(bullet.Weapon.Damage);
                    bullet.InstantDeath();
                }
            }
        }