timer death
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user