Untitled
unknown
plain_text
a year ago
934 B
5
Indexable
Never
private void OnCollisionEnter2D(Collision2D collision) { if (collision.collider.CompareTag("Bullet")) { if(gunManager.vestActive) { gunManager.vestActive = false; } health--; Debug.Log(health); Die(); } } public void Die() { Debug.Log(health); if (health == 0) { Debug.Log("You have died, sheesh"); this.tag = "Dead"; movement.enabled = false; sword.enabled = false; drop.enabled = false; if (sword.gameObject.activeSelf) { sword.gameObject.SetActive(false); } for (int i = 0; i < weapons.Length; i++) { if (weapons[i].gameObject.activeSelf) { weapons[i].gameObject.SetActive(false); } } playerRig.constraints = RigidbodyConstraints2D.FreezeAll; StartCoroutine(DeadBody()); anim.Play("Death"); StartCoroutine(WaitNextFrame()); } public void VestOn() { health = 2f; } }