Update DamageHandler.cs

This commit is contained in:
orsolya-st
2026-06-07 10:01:23 +02:00
parent 538e5e8af2
commit 0064114899
+14
View File
@@ -54,6 +54,7 @@ public class DamageHandler : MonoBehaviour
{ {
if (fallTime >= maxFallingTime) if (fallTime >= maxFallingTime)
{ {
Debug.Log("fallout --> die call");
Die("fallOut"); Die("fallOut");
} }
fallTime += Time.deltaTime; fallTime += Time.deltaTime;
@@ -142,21 +143,34 @@ public class DamageHandler : MonoBehaviour
public void Die(String reason) public void Die(String reason)
{ {
Debug.Log("Die function triggered");
if (isDead) return; if (isDead) return;
isDead = true; isDead = true;
<<<<<<< Updated upstream
TreeSpawner.treeCount = 0; TreeSpawner.treeCount = 0;
if (reason == "hole") if (reason == "hole")
=======
if(reason == "hole")
>>>>>>> Stashed changes
{ {
TreeSpawner.treeCount = 0;
SceneManager.LoadScene(2, LoadSceneMode.Single); SceneManager.LoadScene(2, LoadSceneMode.Single);
Debug.Log("Died from hole"); Debug.Log("Died from hole");
//Destroy(gameObject);
} else if (reason == "fallDamage" || reason == "fallOut") } else if (reason == "fallDamage" || reason == "fallOut")
{ {
Debug.Log("Fell too much"); Debug.Log("Fell too much");
TreeSpawner.treeCount = 0;
SceneManager.LoadScene(3, LoadSceneMode.Single); SceneManager.LoadScene(3, LoadSceneMode.Single);
<<<<<<< Updated upstream
} else if (reason == "Timer") } else if (reason == "Timer")
{ {
SceneManager.LoadScene(3,LoadSceneMode.Single); SceneManager.LoadScene(3,LoadSceneMode.Single);
=======
//Destroy(gameObject);
>>>>>>> Stashed changes
} }
Destroy(gameObject); Destroy(gameObject);
} }