public void FirstDetectTarget() { // detect first object at start RaycastHit[] camerahits; camerahits = Physics.RaycastAll(transform.position, transform.forward, DetectorLength); for (var i = 0; i < camerahits.Length; i++) { RaycastHit hitcam = camerahits [i]; if (hitcam.collider) { if (tagCheck(hitcam.collider.tag) && hitcam.collider.gameObject != this.gameObject) { AS_BulletHiter bulletHit = hitcam.collider.gameObject.GetComponent <AS_BulletHiter> (); if (bulletHit != null && bulletHit.HasAction) { if (actionPreset && !firsthited) { actionPreset.BaseDistance = bulletHit.BaseActionDistance; actionPreset.FirstDetected(this, bulletHit, hitcam.point); } } } } } }
public void FirstDetectTarget() { RaycastHit[] camerahits; camerahits = Physics.RaycastAll(transform.position, transform.forward, DetectorLength); for (var i = 0; i < camerahits.Length; i++) { RaycastHit hitcam = camerahits[i]; if (hitcam.collider) { if (tagCheck(hitcam.collider.tag) && hitcam.collider.tag != this.gameObject.tag) { if (hitcam.collider.GetComponent <AS_BulletHiter>()) { AS_BulletHiter bulletHit = hitcam.collider.gameObject.GetComponent <AS_BulletHiter>(); if (actionPreset && !firsthited) { actionPreset.FirstDetected(this, bulletHit, hitcam.point); } } } } } }