diff options
Diffstat (limited to 'Assets')
| -rw-r--r-- | Assets/Audio.meta | 8 | ||||
| -rwxr-xr-x | Assets/Audio/Splattack!.mp3 | bin | 0 -> 6344580 bytes | |||
| -rw-r--r-- | Assets/Audio/Splattack!.mp3.meta | 22 | ||||
| -rw-r--r-- | Assets/Prefabs/AudioManager.prefab | 52 | ||||
| -rw-r--r-- | Assets/Prefabs/AudioManager.prefab.meta | 7 | ||||
| -rw-r--r-- | Assets/Scenes/SampleScene.unity | 85 | ||||
| -rw-r--r-- | Assets/Scripts/AudioManager.cs | 50 | ||||
| -rw-r--r-- | Assets/Scripts/AudioManager.cs.meta | 11 | ||||
| -rw-r--r-- | Assets/Scripts/Sound.cs | 21 | ||||
| -rw-r--r-- | Assets/Scripts/Sound.cs.meta | 11 |
10 files changed, 259 insertions, 8 deletions
diff --git a/Assets/Audio.meta b/Assets/Audio.meta new file mode 100644 index 0000000..4f63362 --- /dev/null +++ b/Assets/Audio.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3392a707d8df9c42f8a48d831118b805 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Audio/Splattack!.mp3 b/Assets/Audio/Splattack!.mp3 Binary files differnew file mode 100755 index 0000000..21507c6 --- /dev/null +++ b/Assets/Audio/Splattack!.mp3 diff --git a/Assets/Audio/Splattack!.mp3.meta b/Assets/Audio/Splattack!.mp3.meta new file mode 100644 index 0000000..91a43dc --- /dev/null +++ b/Assets/Audio/Splattack!.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 6a9608ee2b7b5882f920e1ef26f99edc +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: diff --git a/Assets/Prefabs/AudioManager.prefab b/Assets/Prefabs/AudioManager.prefab new file mode 100644 index 0000000..0092a9b --- /dev/null +++ b/Assets/Prefabs/AudioManager.prefab @@ -0,0 +1,52 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8450095133606623984 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8450095133606623982} + - component: {fileID: 8450095133606623985} + m_Layer: 0 + m_Name: AudioManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8450095133606623982 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8450095133606623984} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 2.08, y: 20.359, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &8450095133606623985 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8450095133606623984} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5fe85533f1d727df19e1652886eea897, type: 3} + m_Name: + m_EditorClassIdentifier: + sounds: + - name: Splattack! + clip: {fileID: 8300000, guid: 6a9608ee2b7b5882f920e1ef26f99edc, type: 3} + volume: 1 + pitch: 1 + loop: 1 + source: {fileID: 0} diff --git a/Assets/Prefabs/AudioManager.prefab.meta b/Assets/Prefabs/AudioManager.prefab.meta new file mode 100644 index 0000000..22fa09b --- /dev/null +++ b/Assets/Prefabs/AudioManager.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8489462a89be80c6e91509d42a08b050 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 8321c16..a8a38fb 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -384,7 +384,7 @@ Transform: m_LocalScale: {x: 3, y: 3, z: 3} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 6 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &705507993 GameObject: @@ -476,7 +476,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 0 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} --- !u!1 &832029363 GameObject: @@ -660,7 +660,7 @@ Transform: m_LocalScale: {x: 1, y: 0.3609, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &895538662 GameObject: @@ -967,7 +967,7 @@ Transform: m_LocalScale: {x: 1, y: 0.5, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 7 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1343977742 GameObject: @@ -1063,7 +1063,7 @@ RectTransform: - {fileID: 409746969} - {fileID: 832029364} m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1111,7 +1111,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1704194732 GameObject: @@ -1204,7 +1204,7 @@ Transform: m_LocalScale: {x: 100, y: 1, z: 100} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &990268100329211355 PrefabInstance: @@ -1261,7 +1261,7 @@ PrefabInstance: - target: {fileID: 990268100192312561, guid: 61c68b207aaeb438fa625409d4c9247e, type: 3} propertyPath: m_RootOrder - value: 4 + value: 5 objectReference: {fileID: 0} - target: {fileID: 990268100192312561, guid: 61c68b207aaeb438fa625409d4c9247e, type: 3} @@ -1285,3 +1285,72 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 61c68b207aaeb438fa625409d4c9247e, type: 3} +--- !u!1001 &8450095133562720382 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 8450095133606623982, guid: 8489462a89be80c6e91509d42a08b050, + type: 3} + propertyPath: m_LocalPosition.x + value: 2.08 + objectReference: {fileID: 0} + - target: {fileID: 8450095133606623982, guid: 8489462a89be80c6e91509d42a08b050, + type: 3} + propertyPath: m_LocalPosition.y + value: 20.359 + objectReference: {fileID: 0} + - target: {fileID: 8450095133606623982, guid: 8489462a89be80c6e91509d42a08b050, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8450095133606623982, guid: 8489462a89be80c6e91509d42a08b050, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8450095133606623982, guid: 8489462a89be80c6e91509d42a08b050, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8450095133606623982, guid: 8489462a89be80c6e91509d42a08b050, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8450095133606623982, guid: 8489462a89be80c6e91509d42a08b050, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8450095133606623982, guid: 8489462a89be80c6e91509d42a08b050, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8450095133606623982, guid: 8489462a89be80c6e91509d42a08b050, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8450095133606623982, guid: 8489462a89be80c6e91509d42a08b050, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8450095133606623982, guid: 8489462a89be80c6e91509d42a08b050, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8450095133606623984, guid: 8489462a89be80c6e91509d42a08b050, + type: 3} + propertyPath: m_Name + value: AudioManager + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 8489462a89be80c6e91509d42a08b050, type: 3} diff --git a/Assets/Scripts/AudioManager.cs b/Assets/Scripts/AudioManager.cs new file mode 100644 index 0000000..23042c1 --- /dev/null +++ b/Assets/Scripts/AudioManager.cs @@ -0,0 +1,50 @@ +using UnityEngine;
+using UnityEngine.Audio;
+using System;
+
+public class AudioManager : MonoBehaviour
+{
+ public Sound[] sounds;
+
+ public static AudioManager instance;
+
+ // Start is called before the first frame update
+ void Awake()
+ {
+ if (instance == null)
+ instance = this;
+ else
+ {
+ Destroy(gameObject);
+ return;
+ }
+
+ DontDestroyOnLoad(gameObject);
+
+ foreach (Sound s in sounds)
+ {
+ s.source = gameObject.AddComponent <AudioSource>();
+ s.source.clip = s.clip;
+
+ s.source.volume = s.volume;
+ s.source.pitch = s.pitch;
+ s.source.loop = s.loop;
+ }
+ }
+
+ void Start()
+ {
+ Play("Splattack!");
+ }
+
+ public void Play(string name)
+ {
+ Sound s = Array.Find(sounds, sound => sound.name == name);
+ if (s == null)
+ {
+ Debug.LogWarning("Sound: " + name + " not found!");
+ return;
+ }
+ s.source.Play();
+ }
+}
diff --git a/Assets/Scripts/AudioManager.cs.meta b/Assets/Scripts/AudioManager.cs.meta new file mode 100644 index 0000000..243aa11 --- /dev/null +++ b/Assets/Scripts/AudioManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5fe85533f1d727df19e1652886eea897 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Sound.cs b/Assets/Scripts/Sound.cs new file mode 100644 index 0000000..d7214a2 --- /dev/null +++ b/Assets/Scripts/Sound.cs @@ -0,0 +1,21 @@ +using UnityEngine;
+using UnityEngine.Audio;
+
+[System.Serializable]
+public class Sound
+{
+ public string name;
+
+ public AudioClip clip;
+
+ [Range(0f, 1f)]
+ public float volume;
+ [Range(.1f, 3)]
+ public float pitch;
+
+ public bool loop;
+
+ [HideInInspector]
+ public AudioSource source;
+
+}
diff --git a/Assets/Scripts/Sound.cs.meta b/Assets/Scripts/Sound.cs.meta new file mode 100644 index 0000000..3a3da0e --- /dev/null +++ b/Assets/Scripts/Sound.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c1898fe7eafa1cd4e91085e11b27a27d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: |
