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);
     }
 }
示例#2
0
    private void OnTriggerEnter2D(Collider2D info)
    {
        EnemyControllerBase enemy = info.GetComponent <EnemyControllerBase>();

        if (enemy != null)
        {
            enemy.TakeDamage(_damage, DamageType.Projectile);
        }
        Destroy(gameObject);
    }
示例#3
0
    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);
    }
示例#5
0
 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);
         }
     }
 }
示例#6
0
    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);
    }