private IEnumerator aquireATK()
    {
        isATKing = true;
        Animator ani = GetComponent <Animator>();

        ani.SetBool("Attack", true);

        yield return(new WaitForSeconds(atkStartSwing));

        if (soundEffect)
        {
            Instantiate(soundEffect, transform.position, transform.localRotation);
        }

        if (!rangedATK)
        {
            if (target != null)
            {
                target.GetDamage(damage);
                Instantiate(meleeEffect, target.transform.position + (transform.up * 2), transform.localRotation);
            }
            else
            {
            }
        }
        else
        {
            ProjectieDummy proj = Instantiate(missile, projPoint.transform.position, transform.localRotation) as ProjectieDummy;
            if (target != null)
            {
                //proj.transform.LookAt(target.transform.position);
                Debug.Log("Throw to Target");
                proj.StartProj(target.transform.position, stat.GetOwner(), damage);
            }
            else
            {
                //proj.transform.LookAt(transform.position + (transform.forward * atkRange));
                Debug.Log("Throw to Point");
                proj.StartProj(transform.position + (transform.forward * atkRange), stat.GetOwner(), damage);
            }
        }
        ani.SetBool("Attack", false);
        yield return(new WaitForSeconds(atkStopSwing));

        UnitMove uni = GetComponent <UnitMove>();

        uni.OrderMove(Vector3.one);
        isATKing = false;
        yield return(null);
    }
예제 #2
0
    private IEnumerator aquireATK()
    {
        //projPoint.transform.LookAt(target.transform);
        if (soundEffect)
        {
            Instantiate(soundEffect, transform.position, transform.localRotation);
        }
        ProjectieDummy proj = Instantiate(missile, projPoint.transform.position, projPoint.transform.rotation) as ProjectieDummy;

        if (target != null)
        {
            //proj.transform.LookAt(target.transform.position);
            Debug.Log("Throw to Target");
            proj.StartProj(target.transform.position, stat.GetOwner(), damage);
        }
        else
        {
            //proj.transform.LookAt(transform.position + (transform.forward * atkRange));
            Debug.Log("Throw to Point");
            proj.StartProj(transform.position + (transform.forward * atkRange), stat.GetOwner(), damage);
        }

        yield return(null);
    }