private void Explode(int eX, int eY, int eZ) { Random r = new Random(); for (int x = eX - WorldSettings.MISSILEEXPLOSIONRADIUS; x < eX + WorldSettings.MISSILEEXPLOSIONRADIUS; x++) { for (int y = eY - WorldSettings.MISSILEEXPLOSIONRADIUS; y < eY + WorldSettings.MISSILEEXPLOSIONRADIUS; y++) { for (int z = eZ - WorldSettings.MISSILEEXPLOSIONRADIUS; z < eZ + WorldSettings.MISSILEEXPLOSIONRADIUS; z++) { if (r.Next(5) != 1) { BlockType type = _world.BlockAt(x, y, z); if (type != BlockType.None && type != BlockType.Water) { _world.RemoveBlock(x, y, z); for (int i = 1; i < 5; i++) { _explosionParticleSystem.AddParticle(new Vector3(eX + 1, eY + 1, eZ + 1), Vector3.Zero); } for (int i = 1; i < 2; i++) { _explosionSmokeParticleSystem.AddParticle(new Vector3(x + 1, y + 1, z + 1), Vector3.Zero); } int sound = r.Next(4); Vector3 explosionPosition = new Vector3(eX, eY, eZ); Vector3 dist = explosionPosition - _player.Position; if (dist.Length() > 0) { float volume = 1 / (dist.Length() * 2); if (volume > 1) { volume = 1; } _explosionSounds[sound].Play(volume, 0, 0); } else { _explosionSounds[sound].Play(); } } } } } } _world.RemoveBlock(eX, eY, eZ); }