From 383121ab52ec64ebe9086c5900cdfd288522358e Mon Sep 17 00:00:00 2001 From: GanX <2423855310@qq.com> Date: Wed, 29 Oct 2025 17:08:56 +0800 Subject: [PATCH] =?UTF-8?q?feat():=E5=AE=8C=E6=88=90=E5=B1=8F=E5=B9=95?= =?UTF-8?q?=E6=95=85=E9=9A=9C=E7=9A=84=E9=9F=B3=E6=95=88=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manager/ScreenGlitchManager.prefab | 99 +++++++++++++++++++ .../Gameplay/Global/ScreenGlitchManager.cs | 7 ++ 2 files changed, 106 insertions(+) diff --git a/Assets/Prefab/Gameplay/Manager/ScreenGlitchManager.prefab b/Assets/Prefab/Gameplay/Manager/ScreenGlitchManager.prefab index 942fb7a..ae53520 100644 --- a/Assets/Prefab/Gameplay/Manager/ScreenGlitchManager.prefab +++ b/Assets/Prefab/Gameplay/Manager/ScreenGlitchManager.prefab @@ -10,6 +10,7 @@ GameObject: m_Component: - component: {fileID: 4221136162904276318} - component: {fileID: 9080026706464259533} + - component: {fileID: 3038609949214541956} m_Layer: 0 m_Name: ScreenGlitchManager m_TagString: Untagged @@ -47,3 +48,101 @@ MonoBehaviour: rendererData: {fileID: 11400000, guid: c40be3174f62c4acf8c1216858c64956, type: 2} featureName: ScreenGlitchFeature glitchDuration: 1 + GlitchSoundSource: {fileID: 3038609949214541956} + GlitchSoundClip: {fileID: 8300000, guid: c30608484fbebf54cb5369393740e335, type: 3} +--- !u!82 &3038609949214541956 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3963564801859128168} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 diff --git a/Assets/Script/Gameplay/Global/ScreenGlitchManager.cs b/Assets/Script/Gameplay/Global/ScreenGlitchManager.cs index 880c3f7..8992399 100644 --- a/Assets/Script/Gameplay/Global/ScreenGlitchManager.cs +++ b/Assets/Script/Gameplay/Global/ScreenGlitchManager.cs @@ -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); }