void OnTriggerStay2D(Collider2D hitInfo) { if (hitInfo.gameObject.tag == "Enemy00") { Destroy(gameObject); Enemy00Script enemy = hitInfo.GetComponent <Enemy00Script>(); enemy.GetDamaged(bulletDamage); } if (hitInfo.gameObject.tag == "StageWall") { Destroy(gameObject); } }
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(); } }