This commit is contained in:
go38coz
2026-06-06 19:44:55 +02:00
parent aff4b38d64
commit ccd3a3b636
2 changed files with 18 additions and 5 deletions
+15 -4
View File
@@ -47,7 +47,7 @@ public class DamageHandler : MonoBehaviour
{
if (fallTime >= maxFallingTime)
{
Die();
Die("fallOut");
}
fallTime += Time.deltaTime;
} else if(currentVelocity >= 0)
@@ -93,13 +93,24 @@ public class DamageHandler : MonoBehaviour
if(this.health <= 0f)
{
Die();
Die("fallDamage");
}
}
public void Die()
public void Die(String reason)
{
SceneManager.LoadScene(3, LoadSceneMode.Single);
if(reason == "hole")
{
SceneManager.LoadScene(3, LoadSceneMode.Single);
Debug.Log("Died from hole");
} else if (reason == "fallDamage")
{
Debug.Log("Died from fall damage");
} else if (reason == "fallOut")
{
Debug.Log("Fell too much");
}
Destroy(gameObject);
}
}