Add jump sounds

This commit is contained in:
haitem 2022-01-30 11:42:15 +01:00
parent 337f009d77
commit e5a83b0434
13 changed files with 129 additions and 0 deletions

View File

@ -1635,6 +1635,12 @@ MonoBehaviour:
runningParticles: {fileID: 1608137079}
mainObject: {fileID: 3244356567786994345}
audioSource: {fileID: 1943902172017936589}
jumpClips:
- {fileID: 8300000, guid: 48262e53308f9ee44b7ea428e20433e8, type: 3}
- {fileID: 8300000, guid: fb8354238ee05b2428c8018b060f8b02, type: 3}
- {fileID: 8300000, guid: c17451694befdcd4c858556777f35b2d, type: 3}
- {fileID: 8300000, guid: da7577d64ed743a479eb66b7b25ef537, type: 3}
- {fileID: 8300000, guid: 494197b7e4667cf429bef31c31392309, type: 3}
audioClips:
- {fileID: 8300000, guid: 5e15f53ccc08c4e4496e13306a9e4743, type: 3}
- {fileID: 8300000, guid: 049628ae43735224990d9bcea2f744ad, type: 3}

View File

@ -33,6 +33,7 @@ public class PlayerController : MonoBehaviour
public ParticleSystem runningParticles;
public Transform mainObject;
public AudioSource audioSource;
public List<AudioClip> jumpClips = new List<AudioClip>();
public List<AudioClip> audioClips = new List<AudioClip>();
// Start is called before the first frame update
@ -138,6 +139,10 @@ public class PlayerController : MonoBehaviour
if (inAir)
{
// Debug.Log("Jump");
if (audioSource != null && jumpClips.Count > 0)
{
audioSource.PlayOneShot(jumpClips[Random.Range(0, jumpClips.Count)]);
}
rb.AddForce(transform.up * jumpSpeed * 100f * Time.deltaTime, ForceMode.Impulse);
inAir = false;
}

8
Assets/Sounds/Jump.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dbb89856740468a45a281b520cce227e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 48262e53308f9ee44b7ea428e20433e8
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:

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: fb8354238ee05b2428c8018b060f8b02
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:

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: c17451694befdcd4c858556777f35b2d
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:

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: da7577d64ed743a479eb66b7b25ef537
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:

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 494197b7e4667cf429bef31c31392309
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: