Example #1
0
    IEnumerator DefenseCoroutine()
    {
        Debug.Log("Started defending");
        // define new lastdefense time
        lastDefenseTime             = Time.time;
        totalWaitBetweenDefenseTime = defenseCooldown.RuntimeValue + defenseDuration.RuntimeValue;

        isDefending = true;
        animator.SetBool("IsDefending", isDefending);
        // make healthbar grey
        ChangeHealthBarColor(Color.grey);

        // activates damage reduction
        playerManager.ActivateDamageReduction();
        yield return(new WaitForSeconds(defenseDuration.RuntimeValue));

        playerManager.DeactivateDamageReduction();

        // color of healthbar to green
        ChangeHealthBarColor(Color.green);


        isDefending = false;
        animator.SetBool("IsDefending", isDefending);
        Debug.Log("Stopped defending.");
    }