timer death

This commit is contained in:
cemt1363
2026-06-07 09:54:33 +02:00
parent fefe7ea97a
commit be72837ff0
6 changed files with 27 additions and 15 deletions
+6 -4
View File
@@ -146,7 +146,7 @@ public class DamageHandler : MonoBehaviour
isDead = true;
TreeSpawner.treeCount = 0;
if(reason == "hole")
if (reason == "hole")
{
SceneManager.LoadScene(2, LoadSceneMode.Single);
Debug.Log("Died from hole");
@@ -154,8 +154,10 @@ public class DamageHandler : MonoBehaviour
{
Debug.Log("Fell too much");
SceneManager.LoadScene(3, LoadSceneMode.Single);
Destroy(gameObject);
} else if (reason == "Timer")
{
SceneManager.LoadScene(3,LoadSceneMode.Single);
}
}
Destroy(gameObject);
}
}
-2
View File
@@ -12,8 +12,6 @@ public class DropletMovement : MonoBehaviour
private bool isGrounded = false;
private float facingDirection = 1f;
private bool isDropping = false;
private float fallTimer;
private bool isFalling;
public float maxFallTime = 0.5f;
// movement
+8 -2
View File
@@ -11,6 +11,12 @@ public class Timer : MonoBehaviour
private bool timerIsRunning = false;
public GameObject targetObject;
public DamageHandler damageHandler;
private void Start()
{
damageHandler = targetObject.GetComponent<DamageHandler>();
}
void Update()
{
@@ -51,8 +57,8 @@ public class Timer : MonoBehaviour
if (timeRemaining <= 0)
{
SceneManager.LoadScene(4, LoadSceneMode.Single);
Destroy(targetObject);
//SceneManager.LoadScene(3, LoadSceneMode.Single);
damageHandler.Die("Timer");
}
}