Added sound when jumping/firing/picking-up

This commit is contained in:
alsarazin 2015-11-30 18:25:48 -05:00
parent 8447b8123a
commit 13cb70e7f1
16 changed files with 297 additions and 11 deletions

Binary file not shown.

View File

@ -47,6 +47,8 @@ GameObject:
- 114: {fileID: 11472154}
- 114: {fileID: 11478382}
- 114: {fileID: 11485758}
- 82: {fileID: 8297600}
- 82: {fileID: 8260042}
m_Layer: 0
m_Name: Player
m_TagString: Player
@ -121,6 +123,146 @@ BoxCollider2D:
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Size: {x: .159999996, y: .239999995}
--- !u!82 &8260042
AudioSource:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 197158}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 2703c121ca5fca441bbefd2256ecbd35, type: 3}
m_PlayOnAwake: 0
m_Volume: .300000012
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
- time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
--- !u!82 &8297600
AudioSource:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 197158}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 9b17eb77ac949714d9ab50a9bb170d8f, type: 3}
m_PlayOnAwake: 0
m_Volume: .100000001
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
- time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
--- !u!95 &9514794
Animator:
serializedVersion: 3
@ -152,6 +294,7 @@ MonoBehaviour:
rocket: {fileID: 5027078, guid: 1cf24e915b357664f94ba440a1d1ec1a, type: 2}
rocket_position_offset: {x: .100000001, y: 0, z: 0}
speed: 3
audioRocket: {fileID: 8260042}
--- !u!114 &11413024
MonoBehaviour:
m_ObjectHideFlags: 1
@ -173,6 +316,7 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 256
jumpForce: 175
audioJump: {fileID: 8297600}
--- !u!114 &11472154
MonoBehaviour:
m_ObjectHideFlags: 1
@ -264,6 +408,42 @@ Prefab:
propertyPath: m_Interpolate
value: 0
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: jumpSound
value:
objectReference: {fileID: 8300000, guid: 9b17eb77ac949714d9ab50a9bb170d8f, type: 3}
- target: {fileID: 0}
propertyPath: volume
value: 1
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_Volume
value: .300000012
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_audioClip
value:
objectReference: {fileID: 8300000, guid: a48a7087d05490f4b913e6cd1d177494, type: 3}
- target: {fileID: 0}
propertyPath: audioJump
value:
objectReference: {fileID: 8297600}
- target: {fileID: 0}
propertyPath: audioRocket
value:
objectReference: {fileID: 8260042}
- target: {fileID: 0}
propertyPath: BypassListenerEffects
value: 0
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: BypassReverbZones
value: 0
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_PlayOnAwake
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 197158}

View File

@ -68,6 +68,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2568094dbdb537b49880253a6eedeada, type: 3}
m_Name:
m_EditorClassIdentifier:
audioPickup: {fileID: 8300000, guid: a48a7087d05490f4b913e6cd1d177494, type: 3}
--- !u!212 &21218118
SpriteRenderer:
m_ObjectHideFlags: 1
@ -100,7 +101,27 @@ Prefab:
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_Modifications:
- target: {fileID: 0}
propertyPath: audioPickup
value:
objectReference: {fileID: 8300000, guid: a48a7087d05490f4b913e6cd1d177494, type: 3}
- target: {fileID: 0}
propertyPath: m_audioClip
value:
objectReference: {fileID: 8300000, guid: a48a7087d05490f4b913e6cd1d177494, type: 3}
- target: {fileID: 0}
propertyPath: m_Volume
value: 1
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_PlayOnAwake
value: 0
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: BypassListenerEffects
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 176050}

View File

@ -68,6 +68,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a395f7557cbd20d45826e16e4264ee4a, type: 3}
m_Name:
m_EditorClassIdentifier:
audioPickup: {fileID: 8300000, guid: a48a7087d05490f4b913e6cd1d177494, type: 3}
health: {fileID: 0}
--- !u!212 &21237158
SpriteRenderer:
@ -130,6 +131,10 @@ Prefab:
propertyPath: m_Radius
value: 2.5
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: audioPickup
value:
objectReference: {fileID: 8300000, guid: a48a7087d05490f4b913e6cd1d177494, type: 3}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 140204}

View File

@ -841,6 +841,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a395f7557cbd20d45826e16e4264ee4a, type: 3}
m_Name:
m_EditorClassIdentifier:
audioPickup: {fileID: 8300000, guid: a48a7087d05490f4b913e6cd1d177494, type: 3}
health: {fileID: 1113329686}
--- !u!61 &1736051096
BoxCollider2D:

View File

@ -3,19 +3,15 @@ using System.Collections;
public class BombPickup : MonoBehaviour
{
void Awake()
{
}
public AudioClip audioPickup;
void OnTriggerEnter2D (Collider2D other)
{
// If the player enters the trigger zone...
if(other.tag == "Player")
{
AudioSource.PlayClipAtPoint(audioPickup, transform.position);
// Increase the number of bombs the player has.
other.GetComponent<LayBombs>().bombCount++;

View File

@ -7,10 +7,13 @@ public class FireScript : MonoBehaviour {
public Vector3 rocket_position_offset;
public float speed = 10f;
public AudioSource audioRocket;
// Update is called once per frame
void Update () {
if (Input.GetButtonDown("Fire1"))
{
audioRocket.Play();
FireRocket(gameObject.GetComponent<PlayerBehavior>().GetFacingRight());
}

View File

@ -6,13 +6,15 @@ using UnityEngine.UI;
public class HealthPickup : MonoBehaviour
{
public AudioClip audioPickup;
public Text health;
void OnTriggerEnter2D(Collider2D other)
{
if(other.tag == "Player")
{
AudioSource.PlayClipAtPoint(audioPickup, transform.position);
// Destroy the crate.
Destroy(gameObject);

View File

@ -15,6 +15,8 @@ public class PlayerBehavior : MonoBehaviour
public LayerMask ground;
public float jumpForce = 7.0f;
public AudioSource audioJump;
private Rigidbody2D rb;
private Animator anim;
private bool facingRight = true;
@ -32,6 +34,7 @@ public class PlayerBehavior : MonoBehaviour
{
if (grounded && Input.GetButtonDown("Jump"))
{
audioJump.Play();
anim.SetBool("Ground", false);
rb.AddForce(new Vector2(0, jumpForce));
}

9
Assets/Sound.meta Normal file
View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 87ea32dcd705a6d4ea164f43731a9994
folderAsset: yes
timeCreated: 1448922331
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Sound/Jump.wav Normal file

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 9b17eb77ac949714d9ab50a9bb170d8f
timeCreated: 1448922331
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Sound/Pickup.wav Normal file

Binary file not shown.

View File

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

BIN
Assets/Sound/Rocket.wav Normal file

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 2703c121ca5fca441bbefd2256ecbd35
timeCreated: 1448923734
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant: