From 57d4683df8db961c5bede7414a7dc9ad090ddba9 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Fri, 13 Apr 2018 08:16:14 +1000 Subject: [PATCH] Making some changes for v1.1 --- Assets/Music/gameoverMusic.wav | 3 + .../gameoverMusic.wav.meta} | 4 +- Assets/Prefabs/MonsterSpawner.prefab | 11 ++- Assets/Scenes/gameover.unity | 81 +++++++++++++++++++ Assets/Scenes/gameplay.unity | 26 +++++- Assets/Scripts/GameOverController.cs | 1 + Assets/Scripts/Monster.cs | 10 ++- Assets/Scripts/MonsterSpawner.cs | 45 ++++++++++- Assets/Sounds/monster_appear.wav | 3 - Assets/Sounds/twig_1.wav | 3 + Assets/Sounds/twig_1.wav.meta | 24 ++++++ Assets/Sounds/twig_2.wav | 3 + Assets/Sounds/twig_2.wav.meta | 24 ++++++ Assets/Sounds/twig_3.wav | 3 + Assets/Sounds/twig_3.wav.meta | 24 ++++++ Assets/Sounds/water.wav | 3 + Assets/Sounds/water.wav.meta | 24 ++++++ 17 files changed, 276 insertions(+), 16 deletions(-) create mode 100644 Assets/Music/gameoverMusic.wav rename Assets/{Sounds/monster_appear.wav.meta => Music/gameoverMusic.wav.meta} (87%) delete mode 100644 Assets/Sounds/monster_appear.wav create mode 100644 Assets/Sounds/twig_1.wav create mode 100644 Assets/Sounds/twig_1.wav.meta create mode 100644 Assets/Sounds/twig_2.wav create mode 100644 Assets/Sounds/twig_2.wav.meta create mode 100644 Assets/Sounds/twig_3.wav create mode 100644 Assets/Sounds/twig_3.wav.meta create mode 100644 Assets/Sounds/water.wav create mode 100644 Assets/Sounds/water.wav.meta diff --git a/Assets/Music/gameoverMusic.wav b/Assets/Music/gameoverMusic.wav new file mode 100644 index 0000000..e4dd9ef --- /dev/null +++ b/Assets/Music/gameoverMusic.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:20576e4a4bd25da903b68f2044b2804ed8950e63a65601f21c867b744fb8170e +size 54904456 diff --git a/Assets/Sounds/monster_appear.wav.meta b/Assets/Music/gameoverMusic.wav.meta similarity index 87% rename from Assets/Sounds/monster_appear.wav.meta rename to Assets/Music/gameoverMusic.wav.meta index 6356ed5..8e5cf64 100644 --- a/Assets/Sounds/monster_appear.wav.meta +++ b/Assets/Music/gameoverMusic.wav.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 9d2dc65077ee37e499754680d6cd37c4 -timeCreated: 1523363911 +guid: 76d90bec02087ee4a85a9c574aec2831 +timeCreated: 1523568639 licenseType: Free AudioImporter: externalObjects: {} diff --git a/Assets/Prefabs/MonsterSpawner.prefab b/Assets/Prefabs/MonsterSpawner.prefab index 59e09bd..504e6ce 100644 --- a/Assets/Prefabs/MonsterSpawner.prefab +++ b/Assets/Prefabs/MonsterSpawner.prefab @@ -19,8 +19,8 @@ GameObject: serializedVersion: 5 m_Component: - component: {fileID: 4910612253286244} - - component: {fileID: 114508120021180596} - component: {fileID: 82296697716139720} + - component: {fileID: 114508120021180596} m_Layer: 0 m_Name: MonsterSpawner m_TagString: Untagged @@ -133,5 +133,14 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: monsterPrefab: {fileID: 0} + monsterPrefab2: {fileID: 0} + monsterPrefab3: {fileID: 0} + monsterPrefab4: {fileID: 0} + twigOne: {fileID: 8300000, guid: a6733a38ded6d734c95864ed96cb77f7, type: 3} + twigTwo: {fileID: 8300000, guid: 4b32f873dc6db214998cb461007ca1e3, type: 3} + twigThree: {fileID: 8300000, guid: 3fd4efba0204a56448fe9430bf530db1, type: 3} + water: {fileID: 8300000, guid: ac24fd5439963184bb234aa526abcfc9, type: 3} + waterSoundOnly: 0 motion: {x: 0, y: 0} delay: 5 + lifespan: 4 diff --git a/Assets/Scenes/gameover.unity b/Assets/Scenes/gameover.unity index f99ec21..77b2d6b 100644 --- a/Assets/Scenes/gameover.unity +++ b/Assets/Scenes/gameover.unity @@ -593,6 +593,7 @@ GameObject: m_Component: - component: {fileID: 1850700147} - component: {fileID: 1850700146} + - component: {fileID: 1850700148} m_Layer: 0 m_Name: GameOverController m_TagString: Untagged @@ -628,6 +629,86 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!82 &1850700148 +AudioSource: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1850700145} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 76d90bec02087ee4a85a9c574aec2831, type: 3} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 1 + 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: 2 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + - serializedVersion: 2 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 0 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 0 --- !u!1 &2135767184 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/gameplay.unity b/Assets/Scenes/gameplay.unity index 3f9092f..99c3a24 100644 --- a/Assets/Scenes/gameplay.unity +++ b/Assets/Scenes/gameplay.unity @@ -493,6 +493,11 @@ Prefab: - target: {fileID: 114508120021180596, guid: b16589ec086fe774ba4170ead0d42374, type: 2} propertyPath: motion.y + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 114508120021180596, guid: b16589ec086fe774ba4170ead0d42374, + type: 2} + propertyPath: lifespan value: 4 objectReference: {fileID: 0} m_RemovedComponents: [] @@ -836,7 +841,7 @@ Prefab: - target: {fileID: 114508120021180596, guid: b16589ec086fe774ba4170ead0d42374, type: 2} propertyPath: motion.x - value: 2 + value: 1 objectReference: {fileID: 0} - target: {fileID: 114508120021180596, guid: b16589ec086fe774ba4170ead0d42374, type: 2} @@ -852,8 +857,18 @@ Prefab: - target: {fileID: 114508120021180596, guid: b16589ec086fe774ba4170ead0d42374, type: 2} propertyPath: motion.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 114508120021180596, guid: b16589ec086fe774ba4170ead0d42374, + type: 2} + propertyPath: waterSoundOnly value: 1 objectReference: {fileID: 0} + - target: {fileID: 114508120021180596, guid: b16589ec086fe774ba4170ead0d42374, + type: 2} + propertyPath: lifespan + value: 8 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: b16589ec086fe774ba4170ead0d42374, type: 2} m_IsPrefabParent: 0 @@ -905,7 +920,7 @@ Prefab: - target: {fileID: 114508120021180596, guid: b16589ec086fe774ba4170ead0d42374, type: 2} propertyPath: motion.x - value: 5 + value: 2.5 objectReference: {fileID: 0} - target: {fileID: 114508120021180596, guid: b16589ec086fe774ba4170ead0d42374, type: 2} @@ -1402,7 +1417,7 @@ Prefab: - target: {fileID: 114508120021180596, guid: b16589ec086fe774ba4170ead0d42374, type: 2} propertyPath: motion.x - value: -5 + value: -2.5 objectReference: {fileID: 0} - target: {fileID: 114508120021180596, guid: b16589ec086fe774ba4170ead0d42374, type: 2} @@ -1433,6 +1448,11 @@ Prefab: value: objectReference: {fileID: 1876593924556066, guid: a3a482c56d8487d4182da0e0cb895726, type: 2} + - target: {fileID: 114508120021180596, guid: b16589ec086fe774ba4170ead0d42374, + type: 2} + propertyPath: lifespan + value: 8 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: b16589ec086fe774ba4170ead0d42374, type: 2} m_IsPrefabParent: 0 diff --git a/Assets/Scripts/GameOverController.cs b/Assets/Scripts/GameOverController.cs index 192d03c..6949107 100644 --- a/Assets/Scripts/GameOverController.cs +++ b/Assets/Scripts/GameOverController.cs @@ -87,6 +87,7 @@ public class GameOverController : MonoBehaviour { IEnumerator OpeningCoroutine() { yield return new WaitForSeconds (0.75f); + background.GetComponent ().Play ("ending_opening", 0, 1f); background.GetComponent ().speed = 0; JumpLeft (); page++; diff --git a/Assets/Scripts/Monster.cs b/Assets/Scripts/Monster.cs index f4f3539..66dfc7a 100644 --- a/Assets/Scripts/Monster.cs +++ b/Assets/Scripts/Monster.cs @@ -4,14 +4,18 @@ using UnityEngine; public class Monster : MonoBehaviour { public int value; + public float lifespan { + set { + //hackfix + StartCoroutine (ReverseDirectionAfter (value / 2)); + StartCoroutine (DestroySelfAfter (value)); + } + } Rigidbody2D rigidBody; void Awake() { rigidBody = GetComponent (); - - StartCoroutine (ReverseDirectionAfter (2f)); - StartCoroutine (DestroySelfAfter (4f)); } void OnMouseOver() { diff --git a/Assets/Scripts/MonsterSpawner.cs b/Assets/Scripts/MonsterSpawner.cs index 5e9d06a..2647ea2 100644 --- a/Assets/Scripts/MonsterSpawner.cs +++ b/Assets/Scripts/MonsterSpawner.cs @@ -2,13 +2,23 @@ using System.Collections.Generic; using UnityEngine; +using Random = UnityEngine.Random; + public class MonsterSpawner : MonoBehaviour { public GameObject monsterPrefab; public GameObject monsterPrefab2; public GameObject monsterPrefab3; public GameObject monsterPrefab4; + + public AudioClip twigOne; + public AudioClip twigTwo; + public AudioClip twigThree; + public AudioClip water; + public bool waterSoundOnly = false; + public Vector2 motion; public float delay; + public float lifespan; AudioSource audioSource; @@ -34,26 +44,53 @@ public class MonsterSpawner : MonoBehaviour { GameObject monster = Instantiate (monsterPrefab); monster.transform.position = transform.position; monster.GetComponent ().velocity = motion; - audioSource.Play (); + monster.GetComponent ().lifespan = lifespan; + PlaySound (); //ugly duplication yield return new WaitForSeconds (delay); monster = Instantiate (monsterPrefab2); monster.transform.position = transform.position; monster.GetComponent ().velocity = motion; - audioSource.Play (); + monster.GetComponent ().lifespan = lifespan; + PlaySound (); yield return new WaitForSeconds (delay); monster = Instantiate (monsterPrefab3); monster.transform.position = transform.position; monster.GetComponent ().velocity = motion; - audioSource.Play (); + monster.GetComponent ().lifespan = lifespan; + PlaySound (); yield return new WaitForSeconds (delay); monster = Instantiate (monsterPrefab4); monster.transform.position = transform.position; monster.GetComponent ().velocity = motion; - audioSource.Play (); + monster.GetComponent ().lifespan = lifespan; + PlaySound (); } } + + void PlaySound() { + AudioClip audioClip = new AudioClip(); + + if (waterSoundOnly) { + audioClip = water; + } else { + int choice = Random.Range (0, 3); + switch(choice) { + case 0: + audioClip = twigOne; + break; + case 1: + audioClip = twigTwo; + break; + case 2: + audioClip = twigThree; + break; + } + } + + audioSource.PlayOneShot (audioClip, 0.3f); + } } diff --git a/Assets/Sounds/monster_appear.wav b/Assets/Sounds/monster_appear.wav deleted file mode 100644 index b83c3d2..0000000 --- a/Assets/Sounds/monster_appear.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:75dc3bae91eb931b922db93c547f638af251659388ca412bc3740e54c17d2f29 -size 194738 diff --git a/Assets/Sounds/twig_1.wav b/Assets/Sounds/twig_1.wav new file mode 100644 index 0000000..1142643 --- /dev/null +++ b/Assets/Sounds/twig_1.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:505eb50929b071af0fe93cc8b1b27e732b8a9c693d90b7cf694b1e91b4ded92c +size 203368 diff --git a/Assets/Sounds/twig_1.wav.meta b/Assets/Sounds/twig_1.wav.meta new file mode 100644 index 0000000..67d3529 --- /dev/null +++ b/Assets/Sounds/twig_1.wav.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: a6733a38ded6d734c95864ed96cb77f7 +timeCreated: 1523568929 +licenseType: Free +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/Sounds/twig_2.wav b/Assets/Sounds/twig_2.wav new file mode 100644 index 0000000..a151873 --- /dev/null +++ b/Assets/Sounds/twig_2.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e65c9fe4a054fec4fdb752d4f84b5754a711b630c7cb32eaccc522b0dedf2253 +size 141422 diff --git a/Assets/Sounds/twig_2.wav.meta b/Assets/Sounds/twig_2.wav.meta new file mode 100644 index 0000000..f0b203f --- /dev/null +++ b/Assets/Sounds/twig_2.wav.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: 4b32f873dc6db214998cb461007ca1e3 +timeCreated: 1523568928 +licenseType: Free +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/Sounds/twig_3.wav b/Assets/Sounds/twig_3.wav new file mode 100644 index 0000000..406799e --- /dev/null +++ b/Assets/Sounds/twig_3.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ff2bf7bdf6e7c57f8b7a04dccd31a8fc96553ee90be1b522d1d271e5d6425ab +size 1253440 diff --git a/Assets/Sounds/twig_3.wav.meta b/Assets/Sounds/twig_3.wav.meta new file mode 100644 index 0000000..a397c99 --- /dev/null +++ b/Assets/Sounds/twig_3.wav.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: 3fd4efba0204a56448fe9430bf530db1 +timeCreated: 1523568928 +licenseType: Free +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/Sounds/water.wav b/Assets/Sounds/water.wav new file mode 100644 index 0000000..fd08aa3 --- /dev/null +++ b/Assets/Sounds/water.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b14f3ddd60d6cc2ec0f6be4aa87e53c00a3677633d5d32fd56b47b550d6cdd0 +size 1845144 diff --git a/Assets/Sounds/water.wav.meta b/Assets/Sounds/water.wav.meta new file mode 100644 index 0000000..5ad3c3c --- /dev/null +++ b/Assets/Sounds/water.wav.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: ac24fd5439963184bb234aa526abcfc9 +timeCreated: 1523568929 +licenseType: Free +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: