public void TakeDamage(float damage) { currentHealth -= damage; if (currentHealth <= 0) { Destroy(gameObject); Level_Loader load = loader.GetComponent <Level_Loader>(); load.LoadNextLevel(0, 3); } }
void Died() { animator.SetBool("isDead", true); GetComponent <BoxCollider2D>().enabled = false; GetComponent <CircleCollider2D>().enabled = false; GetComponent <Rigidbody2D>().gravityScale = 0f; Level_Loader load = loader.GetComponent <Level_Loader>(); load.LoadNextLevel(0, 3); this.enabled = false; }