Ejemplo n.º 1
0
    private IEnumerator DiveAttack()
    {
        isDiveAttack = true;
        animator.SetBool("Dive Attack", true);
        DiveAttackArea.ActivateAttack(_DiveAttack);
        audio.PlayOneShot(Dive);

        while (IsGrounded() == false)
        {
            yield return(null);
        }


        DiveAttackArea.EndAttack();
        DiveExplosion.Play();
        audio.PlayOneShot(DiveImpact);
        isDiveAttack = false;
        animator.SetBool("Dive Attack", false);
        yield return(null);
    }
Ejemplo n.º 2
0
    private IEnumerator ComboAttack()
    {
        float attackTime = .46f;

        animator.SetBool("LAttackFinished", false);

        //First Attack
        isAttacking = true;
        animator.SetBool("LAttackOne", true);
        audio.PlayOneShot(la1);
        AttackArea.ActivateAttack(lightAttack1);

        if (IsGrounded())
        {
            GetComponent <Rigidbody>().AddForce(transform.forward * 200, ForceMode.Impulse);
        }
        else
        {
            jumpVelocity = Vector3.one * 0.0001f;
        }

        bool gotoNextAttack = false;

        float curTime = 0;

        while (curTime <= attackTime)
        {
            if (curTime >= attackTime * .5f)
            {
                AttackArea.EndAttack();
            }

            yield return(null);

            if (Input.GetButtonDown("LightAttack") && curTime >= attackTime * .5f && IsGrounded())
            {
                gotoNextAttack = true;
            }
            curTime += Time.deltaTime;
        }

        //Second Attack
        if (gotoNextAttack)
        {
            animator.SetBool("LAttackTwo", true);
            AttackArea.ActivateAttack(lightAttack2);
            audio.PlayOneShot(la2);
            GetComponent <Rigidbody>().AddForce(transform.forward * 200, ForceMode.Impulse);
            gotoNextAttack = false;

            curTime = 0;
            while (curTime <= attackTime)
            {
                if (curTime >= attackTime * .5f)
                {
                    AttackArea.EndAttack();
                }

                yield return(null);

                if (Input.GetButtonDown("LightAttack") && curTime >= attackTime * .5f)
                {
                    gotoNextAttack = true;
                }
                curTime += Time.deltaTime;
            }

            //Third Attack
            if (gotoNextAttack)
            {
                animator.SetBool("LAttackThree", true);
                AttackArea.ActivateAttack(lightAttack1);
                audio.PlayOneShot(la3);
                ribLook.curZRotation = -90;
                GetComponent <Rigidbody>().AddForce(transform.forward * 500, ForceMode.Impulse);

                yield return(new WaitForSeconds(attackTime * .5f));

                AttackArea.EndAttack();

                yield return(new WaitForSeconds(attackTime * .5f));

                EndComboAttack();
            }
            else
            {
                EndComboAttack();
            }
        }
        else
        {
            EndComboAttack();
        }

        yield return(null);
    }