战斗音效播放速度随战斗速度变化

dev_chengFeng
gaoxin 2020-07-13 17:53:15 +08:00
parent d2f25e1845
commit a37151646a
4 changed files with 25 additions and 3 deletions

View File

@ -497,8 +497,24 @@ function SoundManager.SetBgmEnabled(b)
_bgm_enabled = b
end
-- 设置音效播放速度
function SoundManager.SetAudioSpeed(speed)
speed = speed or 1
for _, unit in ipairs(_backgroundSound) do
unit.audio.pitch = speed
end
for _, unit in ipairs(_soundChannel) do
unit.audio.pitch = speed
end
for _, unit in ipairs(_AmbientChannel) do
unit.audio.pitch = speed
end
end
function SoundManager.Dispose()
SoundManager.Clear()
end
--endregion

View File

@ -632,6 +632,8 @@ function this.SetTimeScale(TimeScale)
Game.GlobalEvent:DispatchEvent(GameEvent.Battle.OnTimeScaleChanged)
-- 真正生效的敌方
Time.timeScale = TimeScale
-- 设置音效播放的速度
SoundManager.SetAudioSpeed(TimeScale)
end
end

View File

@ -294,6 +294,8 @@ function this.BattleEnd(result)
BattleManager.PauseBattle()
-- 强制停止倍速
Time.timeScale = 1
-- 设置音效播放的速度
SoundManager.SetAudioSpeed(1)
--用一个变量接收最近的战斗结果
this.lastBattleResult = {
result = result,
@ -489,6 +491,8 @@ function this:OnClose()
-- BattleManager.SetTimeScale(1)
-- 真正生效的敌方
Time.timeScale = 1
-- 设置音效播放的速度
SoundManager.SetAudioSpeed(1)
if endFunc then
endFunc(this.lastBattleResult)
end

View File

@ -354,9 +354,9 @@ function this.EnemyAppear()
if index == 4 then
-- 提前播放音效
if BattleLogic.CurOrder == 1 then
SoundManager.PlaySound(SoundConfig.Sound_BattleStart_04)
end
-- if BattleLogic.CurOrder == 1 then
-- SoundManager.PlaySound(SoundConfig.Sound_BattleStart_04)
-- end
elseif index == 6 then
--显示血条