A SoundGroup 는 여러 개의 Sounds 에서 볼륨과 효과를 동시에 관리하는 데 사용됩니다.사운드 그룹의 모든 사운드는 그룹의 Volume 속성으로 조정되는 볼륨으로 인해 볼륨이 조정됩니다. 즉, 볼륨이 Sound 할당된 0.5 에 볼륨이 SoundGroup 할당된 0.5 의 효과적인 볼륨이 0.25 됩니다.
SoundGroup 에 자식으로 SoundEffects 가 있으면 그 효과가 그룹의 모든 Sounds 에 적용됩니다.
속성 Sound 값을 설정하여 SoundGroup 속성에 SoundGroup 추가해야 하며, Sound 속성을 단순히 SoundGroup 속성에 부모로 지정하지 않아야 합니다.A 는 한 번에 하나의 그룹에만 속할 수 있지만, 여기에서 설명한 것처럼 그룹을 중첩할 수 있습니다.
음향 그룹에서 SoundGroup와 작업하는 자세한 내용은 참조하십시오.
요약
속성
Sounds에 적용된 볼륨 배율은 다음과 같습니다.The volume multiplier applied to that are in the SoundGroup .
속성
Volume
값은 Sounds 에서 SoundGroup 에 적용된 볼륨 배율에서 벗어날 수 있습니다. 값은 0 에서 10 까지 다양할 수 있습니다.
코드 샘플
This sample demonstrates how a SoundGroup can be used to change the volume of its associated Sounds and apply SoundEffects.
In this example a Sound is instanced in the Workspace and assigned to a new SoundGroup. The Sound is played and during playback the volume is changed via the SoundGroup and a SoundEffect is added.
local SoundService = game:GetService("SoundService")
-- create a sound group
local soundGroup = Instance.new("SoundGroup")
soundGroup.Parent = SoundService
-- create a sound
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://9120386436"
sound.Looped = true
sound.PlaybackSpeed = 2
sound.SoundGroup = soundGroup
sound.Parent = workspace
-- play the sound
sound:Play()
task.wait(10)
-- change the volume
soundGroup.Volume = 0.1
task.wait(3)
-- return the volume
soundGroup.Volume = 0.5
task.wait(4)
-- add a sound effect
local reverb = Instance.new("ReverbSoundEffect")
reverb.Parent = soundGroup