This commit is contained in:
DominikB 2023-06-24 15:13:52 +02:00
parent d8bbb48ccb
commit 2b0daa4e96
2 changed files with 101 additions and 0 deletions

View File

@ -86,6 +86,102 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 6570034849947570412, guid: 525621658d61b09439b07a6c216a3d3a, type: 3}
m_PrefabInstance: {fileID: 2648003974069831317}
m_PrefabAsset: {fileID: 0}
--- !u!82 &9036746185316875154
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9192667587837597305}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 0
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
--- !u!114 &64254787590043949
MonoBehaviour:
m_ObjectHideFlags: 0
@ -100,3 +196,4 @@ MonoBehaviour:
m_EditorClassIdentifier:
fadeTime: 2
refractoryTime: 1.5
fadeSound: {fileID: 8300000, guid: 312118c44c1f6cb4885313d03cb7dd02, type: 3}

View File

@ -11,6 +11,8 @@ private EdgeCollider2D edge;
public float fadeTime;
public float refractoryTime;
private bool gone;
private AudioSource audioSource; // Reference to the AudioSource component
public AudioClip fadeSound; // The sound clip to be played
void Start()
@ -19,6 +21,7 @@ private bool gone;
col = GetComponent<BoxCollider2D>();
edge = GetComponent<EdgeCollider2D>();
gone = false;
audioSource = GetComponent<AudioSource>();
}
void Update()
@ -51,6 +54,7 @@ private bool gone;
col.enabled = false;
edge.enabled = false;
gone = true;
audioSource.PlayOneShot(fadeSound);
}
}