Beispiel #1
0
    void Damage()
    {
        m_Animator.Play("damage");

        --m_iHP;
        if(m_iHP < 0)
        {
            m_SpiderState = eSpiderState.eDead;
        }
        else
        {
           m_SpiderState = eSpiderState.eIdle;
        }
    }
Beispiel #2
0
    void Attack()
    {
        m_fInterval += Time.deltaTime;
        if(m_fInterval > 2)
        {
            m_Animator.Play("attack_Melee");
            m_fInterval = 0;
            m_PlayerState.DamagebyEnmey();
        }

        float fDist = Vector3.Distance(m_TargetTransform.position, transform.position);
        if (fDist > 3f)
        {
            m_SpiderState = eSpiderState.eIdle;
            m_fInterval = 0;
            return;
        }
    }
Beispiel #3
0
    void Dead()
    {
        m_SpiderState = eSpiderState.eNone;
        m_PlayerState.KillUpdate();
        Social.ReportProgress("CgkI4IbB-YQFEAIQAw", 100, AchievementsCallback);

        StartCoroutine(DeadProcess());
        // Destroy(gameObject);
    }
Beispiel #4
0
    void OnCollisionEnter(Collision _coll)
    {
        if(m_SpiderState.Equals(eSpiderState.eNone) || m_SpiderState.Equals(eSpiderState.eDead))
        {
            return;
        }

        m_SpiderState = eSpiderState.eDamage;
    }
Beispiel #5
0
    void Move()
    {
        float fDist = Vector3.Distance(m_TargetTransform.position, transform.position);
        if (fDist < 3f)
        {
            m_SpiderState = eSpiderState.eAttack;
            m_fInterval = 2f;
            return;
        }

        m_Animator.Play("walk");
        Vector3 vDir = m_TargetTransform.position - transform.position;
        vDir.Normalize();

        transform.position += vDir * m_fSpeed * Time.deltaTime;

        Quaternion from = transform.rotation;
        // LookRotation : 방향벡터 -> Quaternion 변환
        Quaternion to = Quaternion.LookRotation(vDir);

        // Lerp 부드럽게 처리
        transform.rotation = Quaternion.Lerp(from, to, 10f * Time.deltaTime);
    }
Beispiel #6
0
    void Idle()
    {
        m_fInterval += Time.deltaTime;
        if(m_fInterval > 5f)
        {
            m_SpiderState = eSpiderState.eMove;
            m_fInterval = 0f;
        }

          //  m_Animator.Play("idle");
    }