private void OnTriggerEnter2D(Collider2D hit) { if (hit.gameObject.tag == "StageWall") { rb2d.velocity = Vector2.zero; canRun = false; } if (hit.gameObject.tag == "Enemy00") { Enemy00Script enemy = hit.GetComponent <Enemy00Script>(); TakeDamage(enemy.damageDealt); enemy.GetDamaged(playerDamage); } if (hit.gameObject.tag == "Item") { ItemScript item = hit.GetComponent <ItemScript>(); gameManagerScript.AddScore(item.value); item.GetDestroyed(); } }