Exemplo n.º 1
0
    //  상태 진행..
    public void Execute(Enemy_StateManager e)
    {
        if (e.SearchTarget())
        {
            e.m_anim.SetBool("ISRUN", true);
            e.m_navAgent.SetDestination(e.m_player.transform.position);

            #region Footstep
            e.m_footstepTimer += Time.deltaTime;

            if (e.m_footstepTimer > e.m_footstepCycle)
            {
                e.m_audioSource.clip = e.m_audioClip[0];
                e.m_audioSource.PlayOneShot(e.m_audioSource.clip);

                AudioClip temp = e.m_audioClip[0];
                e.m_audioClip[0] = e.m_audioClip[1];
                e.m_audioClip[1] = temp;

                e.m_footstepTimer = 0f;
            }
            #endregion

            if (e.canAttack())
            {
                e.ChangeState(Enemy_IDLE.Instance);
            }
        }
        else
        {
            e.ChangeState(Enemy_IDLE.Instance);
        }
    }
Exemplo n.º 2
0
    //  상태 진행..
    public void Execute(Enemy_StateManager e)
    {
        e.m_idleTime += Time.deltaTime;

        if (e.m_idleTime >= 1.5f)
        {
            if (e.SearchTarget())
            {
                if (e.canAttack())
                {
                    e.ChangeState(Enemy_ATTACK.Instance);
                }
                else
                {
                    e.ChangeState(Enemy_RUN.Instance);
                }
            }
            else
            {
                e.ChangeState(Enemy_PATROL.Instance);
            }
        }
    }
Exemplo n.º 3
0
    //  상태 진행..
    public void Execute(Enemy_StateManager e)
    {
        if (e.SearchTarget())
        {
            Vector3 dir = e.m_player.transform.position - e.gameObject.transform.position;
            e.gameObject.transform.forward = Vector3.Lerp(e.gameObject.transform.forward, new Vector3(dir.x, 0f, dir.z), Time.deltaTime * 3f);
            //e.m_upperBody.transform.forward = Vector3.Lerp(e.m_upperBody.transform.forward, dir, Time.deltaTime * 3f);
            //슛포인트도 조정해야함.

            if (e.canAttack())
            {
                e.m_anim.SetBool("ISATTACK", true);
            }
            else
            {
                e.m_idleTime = 1f;//빠르게 재추적하도록 유도.
                e.ChangeState(Enemy_IDLE.Instance);
            }
        }
        else
        {
            e.ChangeState(Enemy_IDLE.Instance);
        }
    }