feat():完成屏幕故障的音效添加
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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