diff --git a/Assets/Prefabs/Bat.prefab b/Assets/Prefabs/Bat.prefab index 882535e..7153267 100644 --- a/Assets/Prefabs/Bat.prefab +++ b/Assets/Prefabs/Bat.prefab @@ -13,6 +13,7 @@ GameObject: - component: {fileID: 4018407283885727215} - component: {fileID: 5337163787054360807} - component: {fileID: 4224870664944535266} + - component: {fileID: -4084164937358032629} m_Layer: 0 m_Name: Bat m_TagString: Enemy @@ -178,6 +179,102 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 1.1846523, y: 1.521285} m_EdgeRadius: 0 +--- !u!82 &-4084164937358032629 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 493245979038171997} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 2a260b816c5584e4bbdc58ca862a5286, type: 3} + m_PlayOnAwake: 0 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + 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: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1 &2874897583829168077 GameObject: m_ObjectHideFlags: 0 @@ -242,7 +339,7 @@ BoxCollider2D: m_IsTrigger: 1 m_UsedByEffector: 0 m_UsedByComposite: 0 - m_Offset: {x: 0.058219433, y: 1.1354268} + m_Offset: {x: 0.058219433, y: 1.6015409} m_SpriteTilingProperty: border: {x: 0, y: 0, z: 0, w: 0} pivot: {x: 0, y: 0} @@ -253,5 +350,5 @@ BoxCollider2D: adaptiveTiling: 0 m_AutoTiling: 0 serializedVersion: 2 - m_Size: {x: 2.125578, y: 2.1344056} + m_Size: {x: 2.125578, y: 1.656923} m_EdgeRadius: 0 diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index 75fd8a8..47d2f2f 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -146,6 +146,7 @@ GameObject: - component: {fileID: 5559747613460074786} - component: {fileID: 2772748892378701928} - component: {fileID: 1842747687311249101} + - component: {fileID: 7723079812236791708} m_Layer: 2 m_Name: Player m_TagString: Player @@ -457,6 +458,102 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 0.34375, y: 0.4375} m_EdgeRadius: 0 +--- !u!82 &7723079812236791708 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5885597207104481991} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 3498b07b14bc248cdbc50aa434f962c2, type: 3} + m_PlayOnAwake: 0 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + 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: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1 &5885597207531562995 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Snake.prefab b/Assets/Prefabs/Snake.prefab index 78553a4..c8c550c 100644 --- a/Assets/Prefabs/Snake.prefab +++ b/Assets/Prefabs/Snake.prefab @@ -13,6 +13,7 @@ GameObject: - component: {fileID: 4018407283885727215} - component: {fileID: 5337163787054360807} - component: {fileID: 4224870664944535266} + - component: {fileID: 432379776948736043} m_Layer: 0 m_Name: Snake m_TagString: Enemy @@ -178,6 +179,102 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 1, y: 0.875} m_EdgeRadius: 0 +--- !u!82 &432379776948736043 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 493245979038171997} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 2a260b816c5584e4bbdc58ca862a5286, type: 3} + m_PlayOnAwake: 0 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + 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: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1 &6199841205034961327 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/SFX/enemy_defeat.wav b/Assets/SFX/enemy_defeat.wav new file mode 100644 index 0000000..84ac822 Binary files /dev/null and b/Assets/SFX/enemy_defeat.wav differ diff --git a/Assets/SFX/enemy_defeat.wav.meta b/Assets/SFX/enemy_defeat.wav.meta new file mode 100644 index 0000000..ed21eca --- /dev/null +++ b/Assets/SFX/enemy_defeat.wav.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 2a260b816c5584e4bbdc58ca862a5286 +AudioImporter: + externalObjects: {} + serializedVersion: 7 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + preloadAudioData: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SFX/player_defeated.wav b/Assets/SFX/player_defeated.wav new file mode 100644 index 0000000..30638ed Binary files /dev/null and b/Assets/SFX/player_defeated.wav differ diff --git a/Assets/SFX/player_defeated.wav.meta b/Assets/SFX/player_defeated.wav.meta new file mode 100644 index 0000000..8fc18d9 --- /dev/null +++ b/Assets/SFX/player_defeated.wav.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 3498b07b14bc248cdbc50aa434f962c2 +AudioImporter: + externalObjects: {} + serializedVersion: 7 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + preloadAudioData: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/GrappleScene.unity b/Assets/Scenes/GrappleScene.unity index bda6d5b..ba7a98d 100644 --- a/Assets/Scenes/GrappleScene.unity +++ b/Assets/Scenes/GrappleScene.unity @@ -5174,7 +5174,7 @@ Tilemap: second: serializedVersion: 2 m_TileIndex: 11 - m_TileSpriteIndex: 8 + m_TileSpriteIndex: 9 m_TileMatrixIndex: 0 m_TileColorIndex: 0 m_TileObjectToInstantiateIndex: 65535 @@ -5244,7 +5244,7 @@ Tilemap: second: serializedVersion: 2 m_TileIndex: 10 - m_TileSpriteIndex: 7 + m_TileSpriteIndex: 8 m_TileMatrixIndex: 0 m_TileColorIndex: 0 m_TileObjectToInstantiateIndex: 65535 @@ -5345,12 +5345,12 @@ Tilemap: m_Data: {fileID: 0} - m_RefCount: 0 m_Data: {fileID: 0} + - m_RefCount: 0 + m_Data: {fileID: 0} - m_RefCount: 1 m_Data: {fileID: -1680641961, guid: 2097266264e574d71a38da279b45c7c0, type: 3} - m_RefCount: 1 m_Data: {fileID: -610258227, guid: 2097266264e574d71a38da279b45c7c0, type: 3} - - m_RefCount: 0 - m_Data: {fileID: 0} - m_RefCount: 2 m_Data: {fileID: 1096025109, guid: 2097266264e574d71a38da279b45c7c0, type: 3} - m_RefCount: 2 @@ -5874,7 +5874,7 @@ AudioSource: OutputAudioMixerGroup: {fileID: 0} m_audioClip: {fileID: 8300000, guid: 9567c15965a4246e0bd2f434e2d6fac6, type: 3} m_PlayOnAwake: 1 - m_Volume: 1 + m_Volume: 0.75 m_Pitch: 1 Loop: 1 Mute: 0 diff --git a/Assets/Scripts/EnemyPatrol.cs b/Assets/Scripts/EnemyPatrol.cs index a4943eb..e5c7382 100644 --- a/Assets/Scripts/EnemyPatrol.cs +++ b/Assets/Scripts/EnemyPatrol.cs @@ -75,6 +75,7 @@ public class EnemyPatrol : MonoBehaviour { IEnumerator Defeat() { this.gameObject.GetComponent().enabled = false; animator.Play("Explosion"); + this.gameObject.GetComponent().Play(); yield return new WaitForSeconds(animator.GetCurrentAnimatorStateInfo(0).length); this.gameObject.GetComponent().enabled = true; this.gameObject.SetActive(false); diff --git a/Assets/Scripts/PlayerBehavior.cs b/Assets/Scripts/PlayerBehavior.cs index 1853df4..1f8f120 100644 --- a/Assets/Scripts/PlayerBehavior.cs +++ b/Assets/Scripts/PlayerBehavior.cs @@ -16,6 +16,7 @@ public class PlayerBehavior : MonoBehaviour [SerializeField] private Launch launcher; [HideInInspector] public bool hasTambourine = true; GameObject tambourine; + bool unlockedTambourine; [Header("Grappling:")] [SerializeField] public Tutorial_GrapplingGun grapplingGun; @@ -28,7 +29,7 @@ public class PlayerBehavior : MonoBehaviour Animator animator; [HideInInspector] public bool playerIsAlive = true; - + void Start() { @@ -41,6 +42,7 @@ public class PlayerBehavior : MonoBehaviour void Update() { + unlockedTambourine = stateController.unlockedTambourine; if (playerIsAlive) { // throw tambourine // if (Input.GetKeyDown(KeyCode.K)) { @@ -110,7 +112,7 @@ public class PlayerBehavior : MonoBehaviour } void ThrowTambourine() { - if (hasTambourine && !grapplingRope.isGrappling) + if (unlockedTambourine && hasTambourine && !grapplingRope.isGrappling) { launcher.ThrowTambourine(forward); hasTambourine = false; @@ -155,6 +157,7 @@ public class PlayerBehavior : MonoBehaviour } else if (col.tag == "instaDeath") { + print("player fell in spikes"); StartCoroutine(DestroyPlayer()); } else if (col.tag == "spawnPoint") { @@ -188,6 +191,7 @@ public class PlayerBehavior : MonoBehaviour collision.gameObject.GetComponent().DefeatEnemy(); } else { StartCoroutine(DestroyPlayer()); + print("enemy defeated player"); } } else if (collision.gameObject.tag == "Projectile") { @@ -197,18 +201,27 @@ public class PlayerBehavior : MonoBehaviour } IEnumerator DestroyPlayer() { - playerIsAlive = false; + if (playerIsAlive) { + print("destroyPlayer called"); + playerIsAlive = false; + AudioSource audio = this.gameObject.GetComponent(); + audio.Play(); - // animate - animator.Play("Die"); - yield return new WaitForSeconds(animator.GetCurrentAnimatorStateInfo(0).length); + // animate + animator.Play("Die"); + // yield return new WaitForSeconds(animator.GetCurrentAnimatorStateInfo(0).length); + yield return new WaitForSeconds(audio.clip.length); - this.stateController.SetDeathCanvasActive(true); + // this.stateController.SetDeathCanvasActive(true); - // destroy all tambourines - GameObject[] currentTambourines = GameObject.FindGameObjectsWithTag("tambourine"); - foreach (GameObject tambourine in currentTambourines) { - tambourine.GetComponent().DestroySelf(); + // destroy all tambourines + GameObject[] currentTambourines = GameObject.FindGameObjectsWithTag("tambourine"); + foreach (GameObject tambourine in currentTambourines) { + // tambourine.GetComponent().DestroySelf(); + Destroy(tambourine); + } + + this.stateController.RespawnPlayer(); } } } diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 2873a79..09cfc29 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -47,6 +47,7 @@ public class PlayerMovement : MonoBehaviour Tutorial_GrapplingRope grapplingRope; bool wasGrappling = false; + bool unlockedTrumpet; //Set all of these up in the inspector [Header("Checks")] @@ -60,6 +61,7 @@ public class PlayerMovement : MonoBehaviour [SerializeField] private LayerMask _groundLayer; [HideInInspector] private PlayerBehavior playerBehavior; + [HideInInspector] private StateController stateController; #endregion private void Awake() @@ -67,7 +69,7 @@ public class PlayerMovement : MonoBehaviour RB = GetComponent(); playerBehavior = this.gameObject.GetComponent(); grapplingRope = playerBehavior.grapplingRope; - + stateController = GameObject.FindGameObjectWithTag("StateController").GetComponent(); } private void Start() @@ -94,6 +96,7 @@ public class PlayerMovement : MonoBehaviour private void Update() { + unlockedTrumpet = stateController.unlockedTrumpet; #region TIMERS LastOnGroundTime -= Time.deltaTime; LastOnWallTime -= Time.deltaTime; @@ -125,7 +128,11 @@ public class PlayerMovement : MonoBehaviour if (IsGrounded()) //checks if set box overlaps with ground { LastOnGroundTime = Data.coyoteTime; //if so sets the lastGrounded to coyoteTime - trumpet = 2; + if (unlockedTrumpet) { + trumpet = 2; + } else { + trumpet = 0; + } wasGrappling = false; } diff --git a/Assets/Scripts/StateController.cs b/Assets/Scripts/StateController.cs index 31f5d1d..01eb627 100644 --- a/Assets/Scripts/StateController.cs +++ b/Assets/Scripts/StateController.cs @@ -22,9 +22,14 @@ public class StateController : MonoBehaviour { [Header("Enemies")] GameObject[] enemiesInScene; - [Header("LevelProgression")] + [Header("Level Progression")] GameObject victoryCanvas; + [Header("Unlocked Items")] + [SerializeField] public bool unlockedTrumpet = false; + [SerializeField] public bool unlockedTambourine = false; + [SerializeField] public bool unlockedClarinet = false; + void Awake() { // check to see if a state controller already exists if (GameObject.FindGameObjectWithTag("StateController") != null) { @@ -41,7 +46,9 @@ public class StateController : MonoBehaviour { } } - void OnSceneLoaded(Scene scene, LoadSceneMode mode) { + void OnSceneLoaded(Scene scene, LoadSceneMode mode) { + + #region FIND OBJECTS deathCanvas = GameObject.Find("DeathUICanvas"); if (deathCanvas != null) { Button respawnButton = GameObject.Find("RespawnButton").GetComponent