Merge branch 'main' of https://github.com/orsolya-st/gamejam_050626
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ public class DropletMovement : MonoBehaviour
|
||||
{
|
||||
private Rigidbody2D rb;
|
||||
private Collider2D characterCollider;
|
||||
private DamageHandler damageHandler;
|
||||
|
||||
// helper variables
|
||||
private bool isGrounded = false;
|
||||
@@ -34,7 +35,8 @@ public class DropletMovement : MonoBehaviour
|
||||
{
|
||||
rb = GetComponent<Rigidbody2D>();
|
||||
characterCollider = GetComponent<Collider2D>();
|
||||
|
||||
damageHandler = GetComponent<DamageHandler>();
|
||||
|
||||
TreeSpawner.treeCount = 0;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user