fixed: tambourine ui resets properly on player death

This commit is contained in:
Sam
2023-05-01 16:53:13 -07:00
parent cc694586a4
commit 347b1a0b2c
4 changed files with 64 additions and 26 deletions

View File

@@ -41,7 +41,9 @@ public class PlayerBehavior : MonoBehaviour
{ // initialize
_rb = GetComponent<Rigidbody2D>();
stateController = GameObject.Find("StateController").GetComponent<StateController>();
gameUI = GameObject.FindGameObjectWithTag("GameUICanvas").GetComponent<GameUIController>();
gameUI.ResetInstrumentUI();
audioSource = this.gameObject.GetComponent<AudioSource>();
audioSource.clip = footstepSound;
@@ -235,8 +237,8 @@ public class PlayerBehavior : MonoBehaviour
// destroy all tambourines
GameObject[] currentTambourines = GameObject.FindGameObjectsWithTag("tambourine");
foreach (GameObject tambourine in currentTambourines) {
// tambourine.GetComponent<TambourineBehavior>().DestroySelf();
Destroy(tambourine);
tambourine.GetComponent<TambourineBehavior>().DestroySelf();
// Destroy(tambourine);
}
this.stateController.RespawnPlayer();