Definition
ResumeUpdateEventOfAmbientSound(string ambientSoundName)
Description
This function resumes the script’s Update() event of ambient sound ambientSoundName.
Parameters
ambientSoundName
Specifies the name of the ambient sound. You can also use the name “this” for this parameter. In this case, “this” refers to the ambient sound that this script is attached to.
Example 1
function OnTriggerEnter(otherActorName) --nil means main character controller if otherActorName == nil then PauseUpdateEventOfAmbientSound("ambient1") end end function OnTriggerStay(otherActorName) end function OnTriggerExit(otherActorName) --nil means main character controller if otherActorName == nil then ResumeUpdateEventOfAmbientSound("ambient1") end end
Assume that the above script is attached to a trigger named “trigger1”. When the main character enters “trigger1”, script’s Update() event of ambient sound “ambient1” will be paused. When the main character exits “trigger1”, script’s Update() event of ambient sound “ambient1” will be resumed.
Example 2
--Name of script is ResumeUpdateEventOfAmbientSound2.lua function Init() PauseUpdateEventOfAmbientSound("this") ResumeUpdateEventOfAmbientSound("this") end function Update() PrintConsole("\nUpdate") end
Assume that the above script named ResumeUpdateEventOfAmbientSound2.lua is attached to an ambient sound object named “sound1”. In this case, string “this” in the ResumeUpdateEventOfAmbientSound function will be equal to “sound1”. In our example, we use PauseUpdateEventOfAmbientSound to pause the script’s Update() event of current ambient sound, which is “sound1”. Then we use ResumeUpdateEventOfAmbientSound to resume the script’s Update() event of current ambient sound, which is “sound1”.
ResumeUpdateEventOfAmbientSound