多段伤害音效

This commit is contained in:
xiekaidong 2023-06-02 20:22:54 +08:00
parent 7151a033d7
commit fd4b60dfd2
2 changed files with 12 additions and 2 deletions

View File

@ -1402,7 +1402,17 @@ function BattleUnitComp:onSkillTakeEffect(skill, isFinalBlock, validEffectIdx)
end
local soundHit = skill:getSoundHit()
if soundHit then
BattleHelper:playSkillSound(soundHit, 0)
local blocks = skill:getEffectBlock()
if blocks then
local soundIndex = 1
for i, endIdx in ipairs(blocks) do
if endIdx == effectEndIdx then
soundIndex = i
break
end
end
BattleHelper:playSkillSound(soundHit[soundIndex], 0)
end
end
end
end

View File

@ -242,7 +242,7 @@ function BattleHelper:recycleBuffEffect(buffEffect)
end
function BattleHelper:playSkillSound(name, delay)
if self.skillSoundPath == nil then
if self.skillSoundPath == nil or not name then
return
end
local soundFullPath = self.skillSoundPath[name]