// 넉백에 관한것이 상정되어 있지 않음 public override void Attack() { if (attackBox[_curAttackBox].IsTouchingLayers(_target.gameObject.layer)) { List <Collider2D> colliders = new List <Collider2D>(); attackBox[_curAttackBox].OverlapCollider(filter2D, colliders); foreach (Collider2D collider in colliders) { if (collider.gameObject == this.gameObject) { continue; } UnitBase unitBase = collider.gameObject.GetComponent <UnitBase>(); if (unitBase) { unitBase.Hit(20); } } } }
public void AttackCheck() { if (!_isAttacked && _collider.IsTouchingLayers(targetLayer)) { List <Collider2D> colliders = new List <Collider2D>(); _collider.OverlapCollider(contactFilter, colliders); foreach (var collider in colliders) { if (collider.gameObject == _bulletOwner.gameObject) { continue; } UnitBase unitBase = collider.gameObject.GetComponent <UnitBase>(); if (unitBase) { unitBase.Hit(Random.Range(_bulletOwner.stat.minAtk, _bulletOwner.stat.maxAtk)); _isAttacked = true; Debug.Log("bullet collision occured"); } } } }