public void Atack() { Collider2D[] enemies = Physics2D.OverlapCircleAll(strikePoint.position, atackRange, _enemies); for (int i = 0; i < enemies.Length; i++) { EnemyControllerBase enemy = enemies[i].GetComponent <EnemyControllerBase>(); enemy.TakeDamage(damage); } }
private void OnTriggerEnter2D(Collider2D info) { EnemyControllerBase enemy = info.GetComponent <EnemyControllerBase>(); if (enemy != null) { enemy.TakeDamage(_damage, DamageType.Projectile); } Destroy(gameObject); }
private void PowerAttack() { Collider2D[] enemies = Physics2D.OverlapCircleAll(_PowerAttackPoint.position, _PowerAttackRange, _enemies); for (int i = 0; i < enemies.Length; i++) { EnemyControllerBase enemy = enemies[i].GetComponent <EnemyControllerBase>(); enemy.TakeDamage(_Pdamage, DamageType.PowerStrike); } }
private void OnCollisionEnter2D(Collision2D collision) { EnemyControllerBase enemy = collision.collider.GetComponent <EnemyControllerBase>(); if (enemy == null || damagedEnemies.Contains(enemy)) { return; } enemy.TakeDamage(powerStrikeDamage); damagedEnemies.Add(enemy); }
private void Strike() { Collider2D[] enemies = Physics2D.OverlapCircleAll(_strikePoint.position, _strikeRange, _enemies); for (int i = 0; i < enemies.Length; i++) { EnemyControllerBase enemy = enemies[i].GetComponent <EnemyControllerBase>(); if (enemy != null) { enemy.TakeDamage(_damage); } } }
private void OnCollisionEnter2D(Collision2D collision) { if (!_strikeCollider.enabled) { return; } EnemyControllerBase enemy = collision.collider.GetComponent <EnemyControllerBase>(); if (enemy == null || _damagedEnemies.Contains(enemy)) { return; } enemy.TakeDamage(_powerStrikeDamage, DamageType.PowerStrike); _damagedEnemies.Add(enemy); }