//Tests to see if it collides with the players weapon. private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Boomerang") || collision.gameObject.CompareTag("Sword")) { if (health == maxHealth) { hpBar.gameObject.SetActive(true); hpBar.position = new Vector3(transform.localPosition.x, transform.localPosition.y - 1f, transform.localPosition.z); } if (collision.gameObject.CompareTag("Boomerang")) { health -= PlayerController.player.bDamage(); } else { health -= PlayerController.player.sDamage(); } float f = health / maxHealth; SetSize(f); } if (health <= 0) { Vector3 pos = transform.position; Destroy(gameObject); GameManager.instance.decreaseEnemiesAlive(); dropTable.dropTable(pos); } }