Пример #1
0
    private void _processAnimation()
    {
        if (m_animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1 && !m_animator.IsInTransition(0))
        {
            if (m_animator.GetCurrentAnimatorStateInfo(0).shortNameHash == m_nAnimationThrowReady && m_lastHash != m_nAnimationThrowReady)
            {
                //丢雷
                m_throwBomb.CastSkill();
                m_lastHash = m_nAnimationThrowReady;

                m_animator.SetInteger(m_nAnimatorThrowBombPara, 1);
                m_animator.SetInteger(m_nAnimatorThrowReadyPara, 0);
            }
            else if (m_animator.GetCurrentAnimatorStateInfo(0).shortNameHash == m_nAnimationThrow && m_lastHash != m_nAnimationThrow)
            {
                m_lastHash = m_nAnimationThrow;

                m_animator.SetInteger(m_nAnimatorThrowBombPara, 0);
                m_animator.SetInteger(m_nAnimatorThrowReadyPara, 0);

                int nNeedThrowCounts = 0;
                if (enraged == true)
                {
                    nNeedThrowCounts = throwRageCount;
                }
                else
                {
                    nNeedThrowCounts = throwCount;
                }
                if (m_nBombCounts < nNeedThrowCounts)
                {
                    StartCoroutine(_bombCoroutine());
                }
                else
                {
                    //busy = false;
                    if (enraged == true)
                    {
                        m_bThrowBomb   = false;
                        m_bShootBullet = true;
                    }
                    else
                    {
                        m_bDashToggle = true;
                    }
                    StartCoroutine(StartAttackTimer(false));
                }
            }
        }
    }
Пример #2
0
 IEnumerator ThrowBomb()
 {
     if (busy)
     {
         yield break;
     }
     busy = true;
     //Vector3 direction = (Vector3.up * 2f + (player.position - transform.position).normalized).normalized;
     //GameObject newBullet = Instantiate(bomb, transform.position + bulletInstanceDistance * (Vector3)direction, Quaternion.identity);
     //Rigidbody2D bulletBody = newBullet.GetComponent<Rigidbody2D>();
     //bulletBody.velocity = direction * bombSpeed;
     m_throwBomb.CastSkill();
     busy = false;
     StartCoroutine(StartAttackTimer());
 }
Пример #3
0
    IEnumerator Shoot()
    {
        if (busy)
        {
            yield break;
        }
        busy = true;
        yield return(new WaitForSeconds(shootDelay));

        for (int i = 0; i < shootCount; i++)
        {
            m_shootSkill.CastSkill();
            yield return(new WaitForSeconds(shootInteval));
        }
        m_bShootBullet = false;
        m_bDashToggle  = true;
        busy           = false;
        StartCoroutine(StartAttackTimer());
    }
Пример #4
0
    IEnumerator Shoot()
    {
        if (busy)
        {
            yield break;
        }
        busy = true;
        yield return(new WaitForSeconds(shootDelay));

        for (int i = 0; i < shootCount; i++)
        {
            //Vector3 direction = (player.position - transform.position).normalized;
            //GameObject newBullet = Instantiate(bullet, transform.position + bulletInstanceDistance * (Vector3)direction, Quaternion.identity);
            //Rigidbody2D bulletBody = newBullet.GetComponent<Rigidbody2D>();
            //bulletBody.velocity = direction * bulletSpeed;

            m_shootSkill.CastSkill();
            yield return(new WaitForSeconds(shootInteval));
        }
        busy = false;
        StartCoroutine(StartAttackTimer());
    }