示例#1
0
    protected virtual IEnumerator Whirlwind()
    {
        float angle = 0;

        do
        {
            yield return(null);

            Mana.ConsumeMP(5.0f * Time.deltaTime);

            if (m_Anim.GetCurrentAnimatorStateInfo(0).normalizedTime % 1.0f > 0.9f && m_Anim.GetCurrentAnimatorStateInfo(0).IsName("Whirlwind"))
            {
                WhirlwindFX.SetActive(false);
                WhirlwindFX.SetActive(true);

                SoundManager.Instance.PlaySFX("Whirlwind_Loop", 1.0f, true);
            }
            if (m_Anim.GetCurrentAnimatorStateInfo(0).IsName("WhirlwindShot"))
            {
                MoveUtil.MoveFrame(m_CC, Point, State.WalkSpeed, State.TurnSpeed);

                angle -= Time.deltaTime * State.TurnSpeed;

                WhirlwindFX.transform.localPosition = new Vector3(0, 0, 0);
                WhirlwindFX.transform.localRotation = Quaternion.Euler(90, 0, angle);
            }
        } while (!isNewState);
    }
示例#2
0
    protected virtual IEnumerator Dash()
    {
        do
        {
            yield return(null);

            if (MoveUtil.MoveFrame(m_CC, Point, State.RunSpeed, State.TurnSpeed) < 1.0f)
            {
                DashTrail.SetActive(false);
                SetState(CH_STATE.Wait);
                break;
            }
        } while (!isNewState);
    }
示例#3
0
    protected virtual IEnumerator AttackRun()
    {
        do
        {
            yield return(null);

            //거리가 공격범위 안에 들어오면 공격 상태로 전환

            if (MoveUtil.MoveFrame(m_CC, Point, State.WalkSpeed, State.TurnSpeed) <= State.AttackRange)
            {
                SetState(CH_STATE.Attack);
            }
        } while (!isNewState);
    }
示例#4
0
    IEnumerator RUN()
    {
        do
        {
            yield return(null);

            effect.SetActive(false);

            if (MoveUtil.MoveFrame(cc, movePoint.transform, moveSpeed, 1000) == 0) // 2의 movespeed 1000의 turnspeed로 movepoint까지 이동되면
            {
                SetState(CharacterState.REFLESH);                                  // 도착 후 REFLESH 상태로
                movePoint.SetActive(false);
            }
        } while(state == CharacterState.RUN);
    }
示例#5
0
    protected virtual IEnumerator Run()
    {
        do
        {
            yield return(null);

            //거리가 1미만으로 줄어들면 달리기를 멈춤

            if (MoveUtil.MoveFrame(m_CC, Point, State.WalkSpeed, State.TurnSpeed) < 1.0f)
            {
                SetState(CH_STATE.Wait);
                break;
            }
        } while (!isNewState);
    }
示例#6
0
    protected virtual IEnumerator Run()
    {
        //랜덤으로 wayPoint 중 1개의 좌표를 target 좌표에 담는다.
        do
        {
            yield return(null);


            if (MoveUtil.MoveFrame(characterController, finish, walkSpeed, turnSpeed) == 0)
            {
                //목표지점에 도착하면 Idle 상태로 바꾼다.
                SetState(CharacterState.Idle);
                break;
            }
        } while (!isNewState);
    }
示例#7
0
    IEnumerator HIDERUN()
    {
        //Entry
        do
        {
            yield return(null);

            //Process

            MoveUtil.MoveFrame(cc, attackPoint.transform, 3, 1000);                           //3의 movespeed 1000의 turnspeed로 attackpoint까지 이동

            if (Vector3.Distance(transform.position, attackPoint.transform.position) <= 0.6f) // 캐릭터와 커서 거리가 0.5 이하가 되면
            {
                SetState(CharacterState.HIDE);                                                // 도착 후 숨기 상태로
                attackPoint.SetActive(false);
            }
        } while(state == CharacterState.HIDERUN);
        //Exit
    }
示例#8
0
    protected virtual IEnumerator Bash()
    {
        m_CC.skinWidth = 0.0f;

        do
        {
            yield return(null);

            if (m_Anim.GetCurrentAnimatorStateInfo(0).IsName("Bash") && m_Anim.GetCurrentAnimatorStateInfo(0).normalizedTime % 1.0f > 0.4f)
            {
                m_CC.skinWidth = 0.08f;
                SetState(CH_STATE.Wait);
                break;
            }
            else if (m_Anim.GetCurrentAnimatorStateInfo(0).IsName("Bash") && m_Anim.GetCurrentAnimatorStateInfo(0).normalizedTime % 1.0f < 0.33f)
            {
                MoveUtil.MoveFrame(m_CC, Point, State.RunSpeed, State.TurnSpeed);
            }
        } while (!isNewState);
    }
示例#9
0
    protected virtual IEnumerator Attack2()
    {
        OnAttack();
        anim.Play("Attack2");

        do
        {
            yield return(null);

            if (MoveUtil.MoveFrame(characterController, movePoint, moveSpeed, turnSpeed) == 0) //if 문 전체추가
            {
                movePoint.gameObject.SetActive(false);
                if (anim.GetCurrentAnimatorStateInfo(0).normalizedTime % 1.0f > 0.9f &&
                    anim.GetCurrentAnimatorStateInfo(0).IsName("Attack2"))
                {
                    SetState(CharacterState.Idle);
                    break;
                }
            }
        } while (!isNewState);
    }
示例#10
0
    protected virtual IEnumerator Attack1()
    {
        // Debug.Log("click");
        OnAttack();
        anim.Play("Attack1");

        do
        {
            yield return(null);

            //MoveUtil.cs 의 MoveFrame 을 호출하고 목표지점에 도착했는지 체크한다.
            if (MoveUtil.MoveFrame(characterController, movePoint, moveSpeed, turnSpeed) == 0) //if 문 전체추가
            {
                if (anim.GetCurrentAnimatorStateInfo(0).normalizedTime % 1.0f > 0.9f &&
                    anim.GetCurrentAnimatorStateInfo(0).IsName("Attack1"))
                {
                    SetState(CharacterState.Idle);
                    break;
                }
            }
        } while (!isNewState);
    }
示例#11
0
    void Update()
    {
        RaycastHit hitInfo;

        if (Input.GetMouseButton(0))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hitInfo, 100.0f, layerMask))
            { // 충돌이 있나 체크
                //int layer = hitInfo.collider.gameObject.layer;
                //Debug.Log("layer" + layer + "and" + hitInfo.point); 어차피 찍기 위해서임
                int layer = hitInfo.collider.gameObject.layer;
                if (layer == 9)
                {
                    Destroy(hitInfo.collider.gameObject);
                    return;
                }
                movePos = hitInfo.point;
                ani.SetInteger("state", 1);
            }
        }

        if (ani.GetInteger("state") == 1)
        {
            if (MoveUtil.MoveFrame(controller, movePos, moveSpeed, rotateSpeed) == 0)
            {
                ani.SetInteger("state", 0);
            }
        }
        //if(transform.position != movePos){
        //    Vector3 normal = movePos - transform.position;
        //    normal.Normalize();
        //    controller.Move(normal * moveSpeed*Time.deltaTime);
        //    ani.SetInteger("state", 1);
        //}else{
        //    ani.SetInteger("state", 0);
        //}

        //float h = Input.GetAxis("Horizontal");
        //float v = Input.GetAxis("Vertical");

        ////if (ani.GetInteger("state") == 2)
        ////{
        ////    attackTime += Time.deltaTime;
        ////    if (attackTime > 1.0f)
        ////        ani.SetInteger("state", 0);
        ////    return;
        ////}
        ////if (Input.GetButtonDown("Fire1"))
        ////{
        ////    ani.SetInteger("state", 2);
        ////    attackTime = 0.0f;
        ////    return;
        ////}
        //if (h != 0.0f || v != 0.0f)
        //{
        //    controller.Move(transform.forward * v * moveSpeed * Time.deltaTime);
        //    transform.Rotate(0, h * rotateSpeed * Time.deltaTime, 0);
        //    ani.SetInteger("state", 1);
        //}
        //else
        //{
        //    ani.SetInteger("state", 0);
        //}
    }