From 82841da28e8c57352e3817e8e1b681409e198197 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 5 May 2023 16:00:11 -0700 Subject: [PATCH] (probably) fixed bug where enemy doesn't reset if grappled also moved the victory object lower in the brasslands --- Assets/Scenes/Brasslands.unity | 15 +++++++++++++-- Assets/Scripts/EnemyPatrol.cs | 3 +++ Assets/Scripts/StateController.cs | 3 +++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Assets/Scenes/Brasslands.unity b/Assets/Scenes/Brasslands.unity index bbffab3..f2c4649 100644 --- a/Assets/Scenes/Brasslands.unity +++ b/Assets/Scenes/Brasslands.unity @@ -2452,6 +2452,7 @@ MonoBehaviour: yDown: 0 movementVectorVertical: {x: 0, y: 1} moveSpeed: 1 + isPlayingDefeatAnimation: 0 --- !u!251 &87289533 PlatformEffector2D: m_ObjectHideFlags: 0 @@ -3278,6 +3279,7 @@ MonoBehaviour: yDown: 0 movementVectorVertical: {x: 0, y: 1} moveSpeed: 1 + isPlayingDefeatAnimation: 0 --- !u!251 &125680466 PlatformEffector2D: m_ObjectHideFlags: 0 @@ -8140,6 +8142,7 @@ MonoBehaviour: yDown: 0 movementVectorVertical: {x: 0, y: 1} moveSpeed: 2.5 + isPlayingDefeatAnimation: 0 --- !u!251 &331950546 PlatformEffector2D: m_ObjectHideFlags: 0 @@ -8264,6 +8267,7 @@ MonoBehaviour: yDown: 0 movementVectorVertical: {x: 0, y: 1} moveSpeed: 1 + isPlayingDefeatAnimation: 0 --- !u!251 &334660644 PlatformEffector2D: m_ObjectHideFlags: 0 @@ -16626,6 +16630,7 @@ MonoBehaviour: yDown: 0 movementVectorVertical: {x: 0, y: 1} moveSpeed: 1 + isPlayingDefeatAnimation: 0 --- !u!251 &685337255 PlatformEffector2D: m_ObjectHideFlags: 0 @@ -21226,11 +21231,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7938030115108489908, guid: fff4dbc75abf546fe8c72b078d034f73, type: 3} propertyPath: m_LocalPosition.x - value: 42.22651 + value: 40.35 objectReference: {fileID: 0} - target: {fileID: 7938030115108489908, guid: fff4dbc75abf546fe8c72b078d034f73, type: 3} propertyPath: m_LocalPosition.y - value: -0.976223 + value: -4.2 objectReference: {fileID: 0} - target: {fileID: 7938030115108489908, guid: fff4dbc75abf546fe8c72b078d034f73, type: 3} propertyPath: m_LocalPosition.z @@ -21918,6 +21923,7 @@ MonoBehaviour: yDown: 0 movementVectorVertical: {x: 0, y: 1} moveSpeed: 1 + isPlayingDefeatAnimation: 0 --- !u!251 &870280021 PlatformEffector2D: m_ObjectHideFlags: 0 @@ -22777,6 +22783,7 @@ MonoBehaviour: yDown: 0 movementVectorVertical: {x: 0, y: 1} moveSpeed: 1 + isPlayingDefeatAnimation: 0 --- !u!251 &889351566 PlatformEffector2D: m_ObjectHideFlags: 0 @@ -25591,6 +25598,7 @@ MonoBehaviour: yDown: 0 movementVectorVertical: {x: 0, y: 1} moveSpeed: 1 + isPlayingDefeatAnimation: 0 --- !u!251 &1009495252 PlatformEffector2D: m_ObjectHideFlags: 0 @@ -43296,6 +43304,7 @@ MonoBehaviour: yDown: 0 movementVectorVertical: {x: 0, y: 1} moveSpeed: 2.5 + isPlayingDefeatAnimation: 0 --- !u!251 &1767761847 PlatformEffector2D: m_ObjectHideFlags: 0 @@ -50428,6 +50437,7 @@ MonoBehaviour: yDown: 0 movementVectorVertical: {x: 0, y: 1} moveSpeed: 2.5 + isPlayingDefeatAnimation: 0 --- !u!251 &2042660774 PlatformEffector2D: m_ObjectHideFlags: 0 @@ -50552,6 +50562,7 @@ MonoBehaviour: yDown: 0 movementVectorVertical: {x: 0, y: 1} moveSpeed: 1 + isPlayingDefeatAnimation: 0 --- !u!251 &2047200187 PlatformEffector2D: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/EnemyPatrol.cs b/Assets/Scripts/EnemyPatrol.cs index e5c7382..c9cf147 100644 --- a/Assets/Scripts/EnemyPatrol.cs +++ b/Assets/Scripts/EnemyPatrol.cs @@ -23,6 +23,7 @@ public class EnemyPatrol : MonoBehaviour { [Header("General")] public float moveSpeed; Animator animator; + public bool isPlayingDefeatAnimation = false; void Awake() { animator = GetComponent(); @@ -73,11 +74,13 @@ public class EnemyPatrol : MonoBehaviour { } IEnumerator Defeat() { + isPlayingDefeatAnimation = true; 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; + isPlayingDefeatAnimation = false; this.gameObject.SetActive(false); } diff --git a/Assets/Scripts/StateController.cs b/Assets/Scripts/StateController.cs index d7cd2a2..e4ba43b 100644 --- a/Assets/Scripts/StateController.cs +++ b/Assets/Scripts/StateController.cs @@ -203,6 +203,9 @@ public class StateController : MonoBehaviour { foreach (GameObject enemy in enemiesInScene) { + if (enemy.GetComponent().isPlayingDefeatAnimation) { + enemy.SetActive(false); + } enemy.SetActive(true); } }