void OnTriggerStay2D(Collider2D coll) { GameObject target = coll.gameObject; if (target.tag == "Spear") { WeaponSpear spear = target.GetComponentInChildren <WeaponSpear> (); if (Is_Harmful_Spear(spear)) { spear.Stop(); Divide_Asteroid(); } } }
public override void OnTriggerEnter2D(Collider2D coll) { GameObject target = coll.gameObject; if (target.tag == "Spear") { WeaponSpear spear = target.GetComponentInChildren <WeaponSpear> (); if (Is_Harmful_Spear(spear)) { spear.Stop(); Divide_Asteroid(); } } if (target.tag == "Player") { Register_Hit(target); } }