예제 #1
0
    void AoeAttack()
    {
        GameObject.Find("Player").transform.Find("Sprite").gameObject.transform.Find("AOE").gameObject.SetActive(true);
        charstats.DepleteMana(shieldMana);
        aoeDamage = charstats.baseDamage * 2;


        GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");
        foreach (GameObject target in enemies)
        {
            float distance = Vector2.Distance(target.transform.position, transform.position);
            if (distance <= attackDistance)
            {
                EnemyStats enemystat = target.GetComponent <EnemyStats>();
                enemystat.TakeDamage(aoeDamage);
            }
        }
    }