From c51af3ce92a3ccacada57961f5dfeec4ec4e2159 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 30 Apr 2023 14:16:29 -0700 Subject: [PATCH] bugfixed tambourine and player death death still needs work! --- Assets/Animations/Player/Die.anim | 30 ++++++++++++++-------------- Assets/Scenes/GrappleScene.unity | 7 ++++--- Assets/Scripts/CameraMovement.cs | 4 ++++ Assets/Scripts/PlayerBehavior.cs | 5 +---- Assets/Scripts/StateController.cs | 1 + Assets/Scripts/TambourineBehavior.cs | 2 ++ 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Assets/Animations/Player/Die.anim b/Assets/Animations/Player/Die.anim index 1305dc3..45ce833 100644 --- a/Assets/Animations/Player/Die.anim +++ b/Assets/Animations/Player/Die.anim @@ -22,38 +22,38 @@ AnimationClip: curve: - time: 0 value: {fileID: -122338556, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} - - time: 0.083333336 + - time: 0.041666668 value: {fileID: 189834051, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} - - time: 0.16666667 + - time: 0.083333336 value: {fileID: -2024555392, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} - - time: 0.25 + - time: 0.125 value: {fileID: 1086045528, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} - - time: 0.33333334 + - time: 0.16666667 value: {fileID: 884718321, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} - - time: 0.41666666 + - time: 0.20833333 value: {fileID: -460163578, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} - - time: 0.5 + - time: 0.25 value: {fileID: -990243943, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} - - time: 0.5833333 + - time: 0.29166666 value: {fileID: -625216433, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} - - time: 0.6666667 + - time: 0.33333334 value: {fileID: 323212427, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} - - time: 0.75 + - time: 0.375 value: {fileID: 565888814, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} - - time: 0.8333333 + - time: 0.41666666 value: {fileID: 315249131, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} - - time: 0.9166667 + - time: 0.45833334 value: {fileID: -318639155, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} - - time: 1 + - time: 0.5 value: {fileID: 478881412, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} - - time: 1.0833334 + - time: 0.5416667 value: {fileID: 1253964676, guid: ef839c6d1bbb746a8a3f399806a935a5, type: 3} attribute: m_Sprite path: classID: 212 script: {fileID: 0} flags: 2 - m_SampleRate: 12 + m_SampleRate: 24 m_WrapMode: 0 m_Bounds: m_Center: {x: 0, y: 0, z: 0} @@ -89,7 +89,7 @@ AnimationClip: m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 1.1666667 + m_StopTime: 0.5833334 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 diff --git a/Assets/Scenes/GrappleScene.unity b/Assets/Scenes/GrappleScene.unity index 70c0954..5afd29b 100644 --- a/Assets/Scenes/GrappleScene.unity +++ b/Assets/Scenes/GrappleScene.unity @@ -2383,7 +2383,7 @@ Camera: far clip plane: 1000 field of view: 34 orthographic: 1 - orthographic size: 6 + orthographic size: 9 m_Depth: -1 m_CullingMask: serializedVersion: 2 @@ -2407,7 +2407,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 519420028} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -33.22, y: 24.3, z: -10} + m_LocalPosition: {x: -33.22, y: 20.8, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -2430,6 +2430,7 @@ MonoBehaviour: xOffset: 3 yOffset: 1 smoothing: 6 + size: 9 xLocked: 0 yLocked: 0 --- !u!1001 &525785197 @@ -6385,7 +6386,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5885597207104481986, guid: 576d3fc87874f426294e4bbacb171478, type: 3} propertyPath: m_LocalPosition.y - value: 23.3 + value: 19.8 objectReference: {fileID: 0} - target: {fileID: 5885597207104481986, guid: 576d3fc87874f426294e4bbacb171478, type: 3} propertyPath: m_LocalPosition.z diff --git a/Assets/Scripts/CameraMovement.cs b/Assets/Scripts/CameraMovement.cs index 3dd5ebc..8b8b309 100644 --- a/Assets/Scripts/CameraMovement.cs +++ b/Assets/Scripts/CameraMovement.cs @@ -11,6 +11,9 @@ public class CameraMovement : MonoBehaviour { [SerializeField] float yOffset; [SerializeField] float smoothing; + [Header("Positioning")] + [SerializeField] float size; + [Header("Locking")] [SerializeField] bool xLocked; [SerializeField] bool yLocked; @@ -18,6 +21,7 @@ public class CameraMovement : MonoBehaviour { void Awake() { FindPlayer(); + this.gameObject.GetComponent().orthographicSize = size; } // Update is called once per frame diff --git a/Assets/Scripts/PlayerBehavior.cs b/Assets/Scripts/PlayerBehavior.cs index f05abd8..1853df4 100644 --- a/Assets/Scripts/PlayerBehavior.cs +++ b/Assets/Scripts/PlayerBehavior.cs @@ -182,7 +182,7 @@ public class PlayerBehavior : MonoBehaviour } void OnCollisionEnter2D(Collision2D collision) { - if (collision.gameObject.tag == "Enemy") { + if (collision.gameObject.tag == "Enemy" || collision.gameObject.tag == "ProjectileEnemy") { if (collision.transform.position.y < transform.position.y) { _rb.AddForce(Vector2.up * 8, ForceMode2D.Impulse); collision.gameObject.GetComponent().DefeatEnemy(); @@ -210,8 +210,5 @@ public class PlayerBehavior : MonoBehaviour foreach (GameObject tambourine in currentTambourines) { tambourine.GetComponent().DestroySelf(); } - - yield return new WaitForSeconds(2f); - Destroy(this.gameObject); } } diff --git a/Assets/Scripts/StateController.cs b/Assets/Scripts/StateController.cs index 050445e..8d5e044 100644 --- a/Assets/Scripts/StateController.cs +++ b/Assets/Scripts/StateController.cs @@ -102,6 +102,7 @@ public class StateController : MonoBehaviour { } public void RespawnPlayer() { + Destroy(GameObject.FindGameObjectWithTag("Player")); SetDeathCanvasActive(false); GameObject.Find("Main Camera").GetComponent().FindPlayer(); RespawnEnemies(); diff --git a/Assets/Scripts/TambourineBehavior.cs b/Assets/Scripts/TambourineBehavior.cs index e643468..06da9d4 100644 --- a/Assets/Scripts/TambourineBehavior.cs +++ b/Assets/Scripts/TambourineBehavior.cs @@ -54,12 +54,14 @@ public class TambourineBehavior : MonoBehaviour { void OnTriggerEnter2D(Collider2D col) { // print(col.tag); if (col.tag == "Enemy") { + this.gameObject.GetComponent().enabled = false; collidedObject = col.gameObject; print("Pinning to enemy"); this.gameObject.GetComponent().enabled = false; collidedObject.GetComponent().pinned = true; collidedObject.GetComponent().TogglePin(true); } else if (col.tag == "Projectile") { + this.gameObject.GetComponent().enabled = false; collidedObject = col.gameObject; print("pinned to projectile"); this.gameObject.GetComponent().enabled = false;