void OnTriggerEnter2D(Collider2D other) { HitCheck hitCheck = other.GetComponent <HitCheck>(); if (hitCheck != null) { if (hitCheck.shooter.tag != "Player") { hitCheck.CrashMessage(transform); } } }
void Crash(Transform _hit = null) { //setAnimation Boom HitCheck hitCheck = GetComponent <HitCheck>(); List <string> targetTag = hitCheck.targetTag; Collider2D[] overlaps = Physics2D.OverlapCircleAll(transform.position, splashRadius); foreach (Collider2D c in overlaps) { StatusManagement _status = c.gameObject.GetComponent <StatusManagement>(); if (_status == null) { continue; } if (targetTag.Contains(c.tag) && (_hit == null || _hit.transform != c.transform)) { _status.GetDamage(hitCheck.damage, hitCheck.shooter); } } }