音效提交

dev_chengFeng
jiaoyangna 2021-05-13 15:49:39 +08:00
parent 99861a2235
commit 35d0f1337f
2 changed files with 34 additions and 12 deletions

View File

@ -42,6 +42,11 @@ function SingleStoryPlayerView:SetData(data,playerType)
self.gameObject.transform.localPosition = self.startPos
self.gameObject.transform.localScale = Vector3.one * 1.5
self._PlayTimeStamp = {
[0] = 0,
[1] = 0
}
end
function SingleStoryPlayerView:SetRoads0(data)
@ -134,7 +139,6 @@ function SingleStoryPlayerView:SetRoads1(data)
end
function SingleStoryPlayerView:RunMap(isSetRoleDir)
self._PlayTimeStamp = 0
self.roadsIndex = 0
self.state = 1
self.index = self.index + 1
@ -182,19 +186,37 @@ function SingleStoryPlayerView:RunMap(isSetRoleDir)
end
self:StackPop()
end
function SingleStoryPlayerView:PlaySound(time,Sound,curTimeStamp,timeStamp)
LogGreen("curTimeStamp:"..curTimeStamp.." timeStamp:"..timeStamp.." curTimeStamp - timeStamp:"..curTimeStamp - timeStamp)
if curTimeStamp - timeStamp >= time then
LogGreen("播放音效:"..Sound)
SoundManager.PlaySound(Sound)
return true
end
return false
end
function SingleStoryPlayerView:PlayStepSound(indexType,isSetRoleDir)
local curTimeStamp = GetTimeStamp()
if curTimeStamp - self._PlayTimeStamp >= 0.5 then
self._PlayTimeStamp = curTimeStamp
if indexType == 0 then
if isSetRoleDir == 10 then
SoundManager.PlaySound(SoundConfig.STORY_VOICE_1_4)
else
SoundManager.PlaySound(SoundConfig.STORY_FOOT_1_2)
end
else
SoundManager.PlaySound(SoundConfig.STORY_FOOT_1_1)
end
if indexType == 0 then
self.isSet = self:PlaySound(1,(isSetRoleDir == 10 and SoundConfig.STORY_VOICE_1_4 or SoundConfig.STORY_FOOT_1_2),curTimeStamp,self._PlayTimeStamp[0])
if self.isSet then
self._PlayTimeStamp[0] = curTimeStamp
end
elseif indexType == 1 then
self.isSet = self:PlaySound(0.2,SoundConfig.STORY_FOOT_1_1,curTimeStamp,self._PlayTimeStamp[1])
if self.isSet then
self._PlayTimeStamp[1] = curTimeStamp
end
else
self.isSet = self:PlaySound(1,(isSetRoleDir == 10 and SoundConfig.STORY_VOICE_1_4 or SoundConfig.STORY_FOOT_1_2),curTimeStamp,self._PlayTimeStamp[0])
if self.isSet then
self._PlayTimeStamp[0] = curTimeStamp
end
self.isSet = self:PlaySound(0.2,SoundConfig.STORY_FOOT_1_1,curTimeStamp,self._PlayTimeStamp[1])
if self.isSet then
self._PlayTimeStamp[1] = curTimeStamp
end
end
end
-- 角色相关