示例#1
0
    IEnumerator GetParried()
    {
        enAnimator.SetBool("IdleLongStunnable", false); //need to reset animation bools since attack is interrupted
        enAnimator.SetBool("IdleLong", false);

        if (IsAttackingCO != null)
        {
            StopCoroutine(IsAttackingCO);
        }

        enController.enCanMove = false;
        isAttacking            = false;
        enCanAttack            = false;
        Instantiate(parriedParticlePrefab, transform.position, Quaternion.identity);

        isBroken = true;

        Vector3 tempPos = TPOffsetObj.position;

        tempPos += new Vector3(0, .1f, 0);
        AttackIndicator.ShowBreak(tempPos);

        yield return(new WaitForSeconds(.1f));

        if (timeManager != null)
        {
            timeManager.DoSlowMotion();
        }

        particleHits = true;
        //damageTakenMultiplier = 2f; //update to only be called TakeDamage when isBroken is true
        enAnimator.SetTrigger("Stunned");
        yield return(new WaitForSeconds(.5f)); //1.1f //keep this static, transition from initial Stunned to StunnedLoop

        enAnimator.SetBool("IdleLoopStunned", true);

        yield return(new WaitForSeconds(breakDuration)); //1.3f //recoverDuration //change based on phase

        enAnimator.SetBool("IdleLoopStunned", false);
        isBroken = false;
        yield return(new WaitForSeconds(.2f));

        ShowAttackIndicator();
        yield return(new WaitForSeconds(.5f));

        enController.enCanMove = true;
        enCanAttack            = true;
    }
示例#2
0
    IEnumerator StunEnemy(float stunDuration)
    {
        if (!enController.enStunned)
        {
            isBroken = true;
            yield return(new WaitForSeconds(.01f));

            enController.enAnimator.SetTrigger("en2Stunned");

            enController.enStunned = true;
            //StopChase(); //TODO: delete
            enController.enCanAttack = false;
            enController.enCanMove   = false;

            if (initialStunParticle != null)
            {
                Vector3 tempLocation = transform.position;
                tempLocation.y += .5f;

                Instantiate(initialStunParticle, tempLocation, Quaternion.identity, transform);
            }

            if (enController.isAlive)
            {
                Vector3 tempPos = transform.position;
                tempPos += TPOffset;
                AttackIndicator.ShowBreak(tempPos);
            }

            yield return(new WaitForSeconds(stunDuration));

            EnableShield(); //shield is back, no more increased damage taken
            isBroken = false;
            enController.enAnimator.SetTrigger("en2StunRecover");
            yield return(new WaitForSeconds(1f)); //time for recover animation

            enController.enCanMove = true;
            enController.EnEnableFlip(); //precaution in case enemy is stunned during attack and can't flip
            enController.enStunned = false;

            //canChase = true;
            enController.enCanAttack = true;
        }
    }