private void Update() { if (_target == null) { Destroy(this.gameObject); return; } MoveTowardsTarget(); if (Vector2.Distance(_target.transform.position, transform.position) <= 0.18f) { if (_target.Attackable) { _target.TakeDamage(_damage); } Destroy(this.gameObject); } }
protected override void Attack(ScrapBehaviour target) { target.TakeDamage(Damage); }