fixed: player no longer holds grapple after dying to projectile

This commit is contained in:
Sam
2023-05-06 18:25:35 -07:00
parent dcfae28ee3
commit 9b3bc81173
2 changed files with 9 additions and 14 deletions

View File

@@ -226,7 +226,7 @@ public class PlayerBehavior : MonoBehaviour
void LetGoOfGrapple() {
bool currentlyPaused = StateController.Instance.isPaused;
if (grapplingRope.isGrappling && !currentlyPaused) {
print("currently paused is " + currentlyPaused + ", releasing grapple");
// print("currently paused is " + currentlyPaused + ", releasing grapple");
if (tambourine != null) {
tambourine.GetComponent<TambourineBehavior>().DestroySelf();
}
@@ -362,7 +362,10 @@ public class PlayerBehavior : MonoBehaviour
IEnumerator DestroyPlayer() {
if (playerIsAlive) {
print("destroyPlayer called");
if (grapplingRope.isGrappling) {
LetGoOfGrapple();
}
// print("destroyPlayer called");
playerIsAlive = false;
audioSource.clip = deathSound;
audioSource.loop = false;
@@ -371,15 +374,8 @@ public class PlayerBehavior : MonoBehaviour
// animate
animator.Play("Die");
// yield return new WaitForSeconds(animator.GetCurrentAnimatorStateInfo(0).length);
yield return new WaitForSeconds(audioSource.clip.length);
// this.stateController.SetDeathCanvasActive(true);
if (grapplingRope.isGrappling) {
LetGoOfGrapple();
}
// destroy all tambourines
GameObject[] currentTambourines = GameObject.FindGameObjectsWithTag("tambourine");
print("tambs found: " + currentTambourines.Length);