diff --git a/Assets/Scripts/GameObjects/Projectiles/projectileData.lua b/Assets/Scripts/GameObjects/Projectiles/projectileData.lua index b2415d4..2175135 100644 --- a/Assets/Scripts/GameObjects/Projectiles/projectileData.lua +++ b/Assets/Scripts/GameObjects/Projectiles/projectileData.lua @@ -7,7 +7,7 @@ projectiles = { size = {x = 1.2, y = 2.7, z = .54}, speed = .5, rotAngle = .1, - explosion = {damage = 100, radius = 20}, + explosion = {damage = 100, radius = 20, sfx = PATH .. 'Sounds/SFX/Explosions/explosion02.ogg'}, directHitDamage = 450, rayLength = 1.25, name = "Cruise missile", @@ -18,7 +18,7 @@ projectiles = { projectileClass = ProjectileClass.TORPEDO, size = {x = .2, y = 1.6, z = .2}, speed = .06, - explosion = {damage = 20, radius = 3}, + explosion = {damage = 20, radius = 3, sfx = PATH .. 'Sounds/Units/Submarines/torpedo.ogg'}, directHitDamage = 450, rayLength = .75, name = "Torpedo", diff --git a/Assets/Sounds/Units/Submarines/missile.ogg b/Assets/Sounds/Units/Submarines/missile.ogg new file mode 100644 index 0000000..5b264e4 Binary files /dev/null and b/Assets/Sounds/Units/Submarines/missile.ogg differ diff --git a/Assets/Sounds/Units/Submarines/torpedo.ogg b/Assets/Sounds/Units/Submarines/torpedo.ogg new file mode 100644 index 0000000..094bc6f Binary files /dev/null and b/Assets/Sounds/Units/Submarines/torpedo.ogg differ diff --git a/Assets/Sounds/Units/Submarines/torpedo.wav b/Assets/Sounds/Units/Submarines/torpedo.wav deleted file mode 100644 index c7ed45a..0000000 Binary files a/Assets/Sounds/Units/Submarines/torpedo.wav and /dev/null differ diff --git a/projectile.cpp b/projectile.cpp index 97f3260..b5a39a8 100755 --- a/projectile.cpp +++ b/projectile.cpp @@ -64,12 +64,9 @@ namespace battleship{ } void Projectile::initSound(){ - GameManager *gm = GameManager::getSingleton(); explosionSfxBuffer = new sf::SoundBuffer(); - string p2 = gm->getPath() + "Sounds/SFX/Explosions/explosion0" + to_string(rand() % 4) + ".ogg"; - - if(explosionSfxBuffer->loadFromFile(p2.c_str())) - explosionSfx = new sf::Sound(*explosionSfxBuffer); + string sfxPath = generateView()[GameObject::getGameObjTableName()][id + 1]["explosion"]["sfx"]; + explosionSfx = GameObject::prepareSfx(explosionSfxBuffer, sfxPath); } void Projectile::update() {