Пример #1
0
 IEnumerator PerformTornado()
 {
     cDuration = 0;
     while (cDuration < duration)
     {
         thingsHit = Physics.OverlapSphere(transform.position, radius);
         foreach (Collider c in thingsHit)
         {
             if (c.CompareTag("Enemy"))
             {
                 currentEnemy = c.GetComponent <Goblin_ro_ctrl>();
                 if (!currentEnemy.brute)
                 {
                     currentEnemy.ChangeWalkState(0);
                     currentEnemy.beingPulled  = true;
                     currentEnemy.pullLocation = transform.position + new Vector3(0, 1, 0);
                     currentEnemy.TakeDamage(damage);
                 }
             }
         }
         cDuration += tickRate;
         yield return(new WaitForSeconds(tickRate));
     }
     thingsHit = Physics.OverlapSphere(transform.position, radius);
     foreach (Collider c in thingsHit)
     {
         if (c.CompareTag("Enemy"))
         {
             if (!currentEnemy.dead)
             {
                 currentEnemy = c.GetComponent <Goblin_ro_ctrl>();
                 currentEnemy.ChangeWalkState(2);
                 currentEnemy.beingPulled = false;
             }
         }
     }
     StartCoroutine(PerformFadeWindCircle(1, -1));
 }
Пример #2
0
    IEnumerator DelayForDamage()
    {
        cEnemy      = null;
        minDistance = 500;
        Collider[] thingsHit = Physics.OverlapSphere(transform.position, radius);
        foreach (Collider c in thingsHit)
        {
            if (c.CompareTag("Enemy"))
            {
                if (Vector3.Distance(transform.position, c.transform.position) < minDistance)
                {
                    minDistance = Vector3.Distance(transform.position, c.transform.position);
                    cEnemy      = c.GetComponent <Goblin_ro_ctrl>();
                }
            }
        }
        animation = Instantiate(lightningBolt) as GameObject;
        animation.GetComponent <ParticleSystem>().time = 1.9f;
        if (cEnemy != null)
        {
            animation.transform.position = cEnemy.transform.position;
        }
        else
        {
            animation.transform.position = transform.position;
        }
        yield return(new WaitForSeconds(delay));

        GetComponent <AudioSource>().Play();
        if (cEnemy != null && !cEnemy.dead)
        {
            cEnemy.TakeDamage(damage);
        }


        StartCoroutine(PerformFadeFireCircle(1, -1));
    }