private void OnTriggerEnter(Collider other) { Ene enemy = other.GetComponent <Ene>(); if (enemy != null) { enemy.Damaging(damage); } Destroy(gameObject); }
void Shot() { RaycastHit2D hitInformation = Physics2D.Raycast(fireSpot.position, fireSpot.right); if (hitInformation) { Ene enemy = hitInformation.transform.GetComponent <Ene>(); if (enemy != null) { enemy.Damaging(dama); } Instantiate(imaEff, hitInformation.point, Quaternion.identity); } }