Exemple #1
0
        private void CollizionForBulletAndShip(IBullet bullet, ShipBase ship)
        {
            if (((bullet.Coordinates - ship.Coordinates).Length() > 32) || (bullet.Shooter == ship.Player.Name))
            {
                return;
            }

            var firstPart  = ship.Coordinates + ship.MoveVector * 15;
            var secondPart = ship.Coordinates - ship.MoveVector * 15;

            if (((bullet.Coordinates - ship.Coordinates).Length() > 16) && ((bullet.Coordinates - firstPart).Length() > 16) && ((bullet.Coordinates - secondPart).Length() > 16))
            {
                return;
            }

            ship.Health -= bullet.Damage;
            bullet.Dispose();
        }