diff --git a/Assets/AudioManager.meta b/Assets/AudioManager.meta new file mode 100644 index 0000000..7f41aa2 --- /dev/null +++ b/Assets/AudioManager.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 50e31b970e23305488a83154ea8c8cb2 +folderAsset: yes +timeCreated: 1477850803 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AudioManager/Ambience_Cave_00.wav b/Assets/AudioManager/Ambience_Cave_00.wav new file mode 100644 index 0000000..0e347d2 Binary files /dev/null and b/Assets/AudioManager/Ambience_Cave_00.wav differ diff --git a/Assets/AudioManager/Ambience_Cave_00.wav.meta b/Assets/AudioManager/Ambience_Cave_00.wav.meta new file mode 100644 index 0000000..ba24ba1 --- /dev/null +++ b/Assets/AudioManager/Ambience_Cave_00.wav.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: f74396619b7154fa5a38a1959cfa67ae +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 1 + sampleRateSetting: 0 + sampleRateOverride: 0 + compressionFormat: 0 + quality: 0 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AudioManager/Ambience_Hell_00.wav b/Assets/AudioManager/Ambience_Hell_00.wav new file mode 100644 index 0000000..2c01802 Binary files /dev/null and b/Assets/AudioManager/Ambience_Hell_00.wav differ diff --git a/Assets/AudioManager/Ambience_Hell_00.wav.meta b/Assets/AudioManager/Ambience_Hell_00.wav.meta new file mode 100644 index 0000000..6eebd4d --- /dev/null +++ b/Assets/AudioManager/Ambience_Hell_00.wav.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: 2c9cfb2c9889844ac889f2ad14683d0e +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 1 + sampleRateSetting: 0 + sampleRateOverride: 0 + compressionFormat: 0 + quality: 0 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AudioManager/Arrow 1.wav b/Assets/AudioManager/Arrow 1.wav new file mode 100644 index 0000000..b2924f3 Binary files /dev/null and b/Assets/AudioManager/Arrow 1.wav differ diff --git a/Assets/AudioManager/Arrow 1.wav.meta b/Assets/AudioManager/Arrow 1.wav.meta new file mode 100644 index 0000000..fae422f --- /dev/null +++ b/Assets/AudioManager/Arrow 1.wav.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: 0805de7e4fb0f4d03a30ae90e7c64311 +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 1 + sampleRateSetting: 0 + sampleRateOverride: 0 + compressionFormat: 0 + quality: 0 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AudioManager/Arrow 6.wav b/Assets/AudioManager/Arrow 6.wav new file mode 100644 index 0000000..1085261 Binary files /dev/null and b/Assets/AudioManager/Arrow 6.wav differ diff --git a/Assets/AudioManager/Arrow 6.wav.meta b/Assets/AudioManager/Arrow 6.wav.meta new file mode 100644 index 0000000..6106a1d --- /dev/null +++ b/Assets/AudioManager/Arrow 6.wav.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: e83e7bcb4f4fb4a79a977d9b03628b87 +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 1 + sampleRateSetting: 0 + sampleRateOverride: 0 + compressionFormat: 0 + quality: 0 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AudioManager/Audio.cs b/Assets/AudioManager/Audio.cs new file mode 100644 index 0000000..4b75730 --- /dev/null +++ b/Assets/AudioManager/Audio.cs @@ -0,0 +1,16 @@ +using UnityEngine; +using System.Collections; + +public class Audio : MonoBehaviour { + AudioSource aus; + // Use this for initialization + public void PlaySoundOnce (AudioClip song){ + StartCoroutine (PlaySoundCoroutine (song)); + } + IEnumerator PlaySoundCoroutine(AudioClip sound){ + aus = GetComponent (); + aus.PlayOneShot (sound); + yield return new WaitForSeconds (sound.length); + Destroy (gameObject); + } +} diff --git a/Assets/AudioManager/Audio.cs.meta b/Assets/AudioManager/Audio.cs.meta new file mode 100644 index 0000000..c18b44b --- /dev/null +++ b/Assets/AudioManager/Audio.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bc2b62a66353228499d873aa87df6856 +timeCreated: 1477899362 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AudioManager/Audio.prefab b/Assets/AudioManager/Audio.prefab new file mode 100644 index 0000000..edfa7cc --- /dev/null +++ b/Assets/AudioManager/Audio.prefab @@ -0,0 +1,128 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1000010051293816} + m_IsPrefabParent: 1 +--- !u!1 &1000010051293816 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 4000013545904244} + - 114: {fileID: 114000011367234474} + - 82: {fileID: 82000010457914330} + m_Layer: 0 + m_Name: Audio + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4000013545904244 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000010051293816} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.165492, y: 5.1624355, z: -1.8925428} + m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!82 &82000010457914330 +AudioSource: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000010051293816} + 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 + 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 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 0 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 0 +--- !u!114 &114000011367234474 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1000010051293816} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bc2b62a66353228499d873aa87df6856, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/AudioManager/Audio.prefab.meta b/Assets/AudioManager/Audio.prefab.meta new file mode 100644 index 0000000..250ae0c --- /dev/null +++ b/Assets/AudioManager/Audio.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0c8d88d53b46acb48b5bee989993566c +timeCreated: 1477899384 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AudioManager/AudioManager.cs b/Assets/AudioManager/AudioManager.cs new file mode 100644 index 0000000..c546938 --- /dev/null +++ b/Assets/AudioManager/AudioManager.cs @@ -0,0 +1,57 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + +public class AudioManager : MonoBehaviour { + + public Dictionary mapSound; + public AudioClip[] sounds; //0 Sword + //1 DodgeSword + //1 Dodge + //1 Sword + //1 Sword + //1 Sword + public GameObject auxiliar; //objeto para variables temporales + public AudioClip backgroundSound;//musica de fondo + AudioSource aus; //nuestro "reproductor" + public string dir; //de donde cargamos los sonidos + public static AudioManager instance = null; + // Use this for initialization + void Start () { + loadMap (); + //Check if there is already an instance of SoundManager + if (instance == null) + //if not, set it to this. + instance = this; + //If instance already exists: + else if (instance != this) + //Destroy this, this enforces our singleton pattern so there can only be one instance of SoundManager. + Destroy (gameObject); + //Set SoundManager to DontDestroyOnLoad so that it won't be destroyed when reloading our scene. + DontDestroyOnLoad (gameObject); + //Cogemos nuestro componente de sonido y lo reproducimos + aus = GetComponent (); + aus.clip = backgroundSound; + aus.loop = true; + aus.Play(); + } + public void playSound(string name){ + if (mapSound.ContainsKey (name)) { + GameObject inst = Instantiate (auxiliar); + AudioClip temp = sounds[ mapSound[name]]; + inst.GetComponent