Erste Soundeffekte

This commit is contained in:
DominikB
2023-06-24 13:49:28 +02:00
parent da69707106
commit 63e74b9229
12 changed files with 708 additions and 517 deletions

BIN
Assets/AssetsFORELLE/Audio/Soundeffekte/pickupkey.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: d007af7bda8094bf6a5cfa9f63348c79
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -20,6 +20,8 @@ GameObject:
- component: {fileID: 8316039429838813759}
- component: {fileID: 5185316313602682252}
- component: {fileID: 7290952889933214358}
- component: {fileID: 1535821441}
- component: {fileID: 1535821442}
m_Layer: 0
m_Name: Frank
m_TagString: Player
@@ -34,7 +36,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2410396854066836738}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -36.74, y: 2.17, z: -0.022044204}
m_LocalScale: {x: 0.42547998, y: 0.3653795, z: 0.42548}
m_ConstrainProportionsScale: 0
@@ -209,6 +211,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4760965f3d035f84db6a6741d746428c, type: 3}
m_Name:
m_EditorClassIdentifier:
audioSource: {fileID: 1535821442}
watschelSound: {fileID: 8300000, guid: 7a7507d8daac76346847d91274f41378, type: 3}
isPlaying: 0
--- !u!114 &8316039429838813759
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -235,6 +240,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5c8672c5b58eae84da6091aa48615de7, type: 3}
m_Name:
m_EditorClassIdentifier:
keyTakeSound: {fileID: 8300000, guid: d007af7bda8094bf6a5cfa9f63348c79, type: 3}
doorOpenSound: {fileID: 8300000, guid: 879f20b26c613da48b68f618ef7607e4, type: 3}
--- !u!114 &7290952889933214358
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -249,3 +256,198 @@ MonoBehaviour:
m_EditorClassIdentifier:
isFalling: 0
counter: 0
landeSound: {fileID: 8300000, guid: 183f7f089c24b164281e8c5053739412, type: 3}
sprungSound: {fileID: 8300000, guid: 3102ff7609304d84d824678029971c73, type: 3}
isJumping: 0
--- !u!82 &1535821441
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2410396854066836738}
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!82 &1535821442
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2410396854066836738}
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

View File

@@ -59,6 +59,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3743697183328372287, guid: 703dddc0b1ed3464298fa5e1c7c25cf4, type: 3}
propertyPath: audioSource
value:
objectReference: {fileID: 1318859952}
- target: {fileID: 3743697183328372287, guid: 703dddc0b1ed3464298fa5e1c7c25cf4, type: 3}
propertyPath: originalSprite
value:
@@ -71,8 +75,113 @@ PrefabInstance:
propertyPath: activatedSprite
value:
objectReference: {fileID: 21300000, guid: dc19b5a3b36f9fe4fb4798db8a0ca25c, type: 3}
- target: {fileID: 3743697183328372287, guid: 703dddc0b1ed3464298fa5e1c7c25cf4, type: 3}
propertyPath: buttonClickSound
value:
objectReference: {fileID: 8300000, guid: 4d73df53fe172084abe41ff9683bb08e, type: 3}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 703dddc0b1ed3464298fa5e1c7c25cf4, type: 3}
--- !u!1 &1940356979551777536 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 3743697183328372273, guid: 703dddc0b1ed3464298fa5e1c7c25cf4, type: 3}
m_PrefabInstance: {fileID: 2961610043285910833}
m_PrefabAsset: {fileID: 0}
--- !u!82 &1318859952
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1940356979551777536}
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!212 &1940356979551777539 stripped
SpriteRenderer:
m_CorrespondingSourceObject: {fileID: 3743697183328372274, guid: 703dddc0b1ed3464298fa5e1c7c25cf4, type: 3}

View File

@@ -7,28 +7,49 @@ public class FallingDetection : MonoBehaviour
public bool isFalling;
private Animator animator;
public int counter = 0;
private bool wasFallingbefore = false;
private AudioSource audioSource; // Reference to the AudioSource component
public AudioClip landeSound; // The sound clip to be played
public AudioClip sprungSound; // The sound clip to be played
public bool isJumping = false;
private void Start()
{
animator = GetComponent<Animator>();
playerRigidbody = GetComponent<Rigidbody2D>();
charController = gameObject.GetComponent<CharController>();
audioSource = GetComponent<AudioSource>();
}
private void Update()
{
Vector3 velocity = playerRigidbody.velocity;
//Wenn nicht auf boden und geschwindigkeits offset pos
if (!charController.grounded && velocity.y > 0.1f && !isJumping){
audioSource.PlayOneShot(sprungSound);
isJumping = true;
}
if(charController.grounded){
isJumping = false;
}
//Wenn nicht auf boden und geschwindigkeits offset neg
if (!charController.grounded && velocity.y < -0.1f) {
//Wenn er bereits fällt, oder der counter erreicht ist zum fallen
if (isFalling || counter++>90) {
isFalling = true;
animator.SetBool("IsFalling", true);
counter = 0;
wasFallingbefore = true;
}
} else {
isFalling = false;
counter = 0;
animator.SetBool("IsFalling", false);
if(wasFallingbefore){
wasFallingbefore = false;
audioSource.PlayOneShot(landeSound);
}
}
}
}

View File

@@ -12,11 +12,15 @@ using UnityEngine;
public class InventoryBasic : MonoBehaviour
{
private LinkedList<GameObject> items;
private AudioSource audioSource; // Reference to the AudioSource component
public AudioClip keyTakeSound; // The sound clip to be played
public AudioClip doorOpenSound; // The sound clip to be played
// Start is called before the first frame update
void Start()
{
items = new LinkedList<GameObject>();
audioSource = GetComponent<AudioSource>();
}
// Update is called once per frame
@@ -31,12 +35,14 @@ public class InventoryBasic : MonoBehaviour
case "Item":
other.gameObject.SetActive(false);
items.AddFirst(other.gameObject);
audioSource.PlayOneShot(keyTakeSound);
Debug.Log("Pickup: Take " + other.gameObject.name);
break;
case "Openable":
if (removeFirstOccurence("KEY"))
{
audioSource.PlayOneShot(doorOpenSound);
other.gameObject.SetActive(false);
Debug.Log("Pickup: Use Key");
}

View File

@@ -6,11 +6,16 @@ public class IsMovingTester : MonoBehaviour
{
private Animator animator;
private Rigidbody2D rb;
public AudioSource audioSource; // Reference to the AudioSource component
public AudioClip watschelSound; // The sound clip to be played
public bool isPlaying = false; // Boolean to control the sound loop
private FallingDetection fallingDetection;
void Start()
{
animator = GetComponent<Animator>();
rb = GetComponent<Rigidbody2D>();
fallingDetection = gameObject.GetComponent<FallingDetection>();
}
void Update()
@@ -18,10 +23,24 @@ public class IsMovingTester : MonoBehaviour
if (rb.velocity.magnitude > 0.1f)
{
animator.SetBool("IsMoving", true);
//Bewegt sich gerade und kein anderer Wert ist an, ausserdem Spielt es noch nicht
if (!animator.GetBool("IsPushing") && !animator.GetBool("IsFalling")&&!fallingDetection.isJumping){
if(!isPlaying){
audioSource.clip = watschelSound;
audioSource.loop = true;
audioSource.Play();
isPlaying = true;}
} else {
audioSource.Stop();
isPlaying = false;
}
}
else
{
animator.SetBool("IsMoving", false);
audioSource.Stop();
isPlaying = false;
}
}
}

View File

@@ -8,10 +8,13 @@ public GameObject door;
public SpriteRenderer spriteRenderer;
public Sprite originalSprite;
public Sprite activatedSprite;
public AudioSource audioSource; // Reference to the AudioSource component
public AudioClip buttonClickSound; // The sound clip to be played
private bool isActive = false;
// Start is called before the first frame update
void Start()
{
audioSource = GetComponent<AudioSource>();
}
// Update is called once per frame
@@ -24,6 +27,10 @@ void OnTriggerEnter2D(Collider2D other) {
if (other.CompareTag("PressurePlatable")){
door.SetActive(false);
spriteRenderer.sprite = activatedSprite;
if(!isActive){
audioSource.PlayOneShot(buttonClickSound);
isActive = true;
}
}
}

View File

@@ -5,14 +5,18 @@ using UnityEngine;
public class PlayerPressurePlateMod: MonoBehaviour
{
public SpriteRenderer spriteRenderer;
public SpriteRenderer spriteRenderer;
public Sprite originalSprite;
public Sprite activatedSprite;
public GameObject door;
public AudioSource audioSource; // Reference to the AudioSource component
public AudioClip buttonClickSound; // The sound clip to be played
public AudioClip doorOpenSound;
private bool isActive = false;
// Start is called before the first frame update
void Start()
{
audioSource = GetComponent<AudioSource>();
}
// Update is called once per frame
@@ -26,6 +30,13 @@ void OnTriggerEnter2D(Collider2D other) {
// spriteRenderer.sprite = activatedSprite;
//}
spriteRenderer.sprite = activatedSprite;
if(!isActive){
audioSource.PlayOneShot(buttonClickSound);
audioSource.PlayOneShot(doorOpenSound);
isActive = true;
}
door.SetActive(false);
}