feat():完成屏幕故障的音效添加
This commit is contained in:
@@ -17,6 +17,9 @@ namespace Script.Gameplay.Global
|
||||
[Tooltip("要控制的 RendererFeature 名称")] public string featureName = "ScreenGlitchFeature";
|
||||
[SerializeField] private float glitchDuration = 1f;
|
||||
|
||||
[SerializeField] private AudioSource GlitchSoundSource;
|
||||
[SerializeField] private AudioClip GlitchSoundClip;
|
||||
|
||||
public void SetFeatureActive(bool active)
|
||||
{
|
||||
if (rendererData == null)
|
||||
@@ -42,6 +45,10 @@ namespace Script.Gameplay.Global
|
||||
public IEnumerator TriggerGlitchEffect()
|
||||
{
|
||||
SetFeatureActive(true);
|
||||
if (GlitchSoundSource != null && GlitchSoundClip != null)
|
||||
{
|
||||
GlitchSoundSource.PlayOneShot(GlitchSoundClip);
|
||||
}
|
||||
yield return new WaitForSeconds(glitchDuration);
|
||||
SetFeatureActive(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user