예제 #1
0
    public override IEnumerator CastingSkill()
    {
        //casting

        //set animation

        yield return(new WaitForSeconds(ability.CastTime));

        BaseSkillFX.Play();

        int colCount = Physics.OverlapSphereNonAlloc(transform.position, ability.Radius, attackTo, caster.enemiesMask);

        if (colCount > 0)
        {
            for (int i = 0; i < colCount; i++)
            {
                var h = attackTo[i].GetComponent <CharacterStats>();
                if (h)
                {
                    h.GetDamage(ability.MaxDamage, true);
                }
            }
        }



        //state = UnitStates.ATTACKING;
    }
예제 #2
0
    public override IEnumerator CastingSkill()
    {
        //caster.state = UnitStates.TELEPORTATION;
        //SkillCast();
        BaseSkillFX.Play();

        if (caster.GetType() == typeof(EnemyAIbase))
        {
            var enemy = (EnemyAIbase)caster;
            enemy.targetView.SetActive(false);
        }
        //Sound Play

        yield return(new WaitForSeconds(0.8f));

        caster.unitCollider.enabled = false;
        foreach (var renderer in _renderers)
        {
            renderer.enabled = false;
        }

        float t = 2.8f + Random.Range(-0.5f, 0.5f);

        yield return(new WaitForSeconds(teleportationTime));

        /*
         * Vector3 offset = Random.onUnitSphere * UnitSize;
         * offset.y = 0;
         *
         * agent.Warp(target.position + offset);
         */
        transform.position += new Vector3(Random.insideUnitCircle.x, 0, Random.insideUnitCircle.y) * 3;

        BaseSkillFX.Play();
        //Sound Play

        yield return(new WaitForSeconds(1f));

        //transform.rotation = Quaternion.LookRotation(target.position - transform.position);

        caster.unitCollider.enabled = true;

        foreach (var renderer in _renderers)
        {
            renderer.enabled = true;
        }

        //state = UnitStates.ATTACKING;
    }