public void UseAbility()
    {
        if (!abilityActive && GameObject.FindObjectOfType <ProgressTracker>().GameStillInSession() && !player.GetAbilityUseStatus())
        {
            switch (abilityType)
            {
            case AbilityType.defense: {
                abilityActive = true;
                HealthBehavior playerHealth = player.GetComponent <HealthBehavior>();
                playerHealth.SetDividerValue(potency + 1);
                playerHealth.EnableBlockDamage(true);
                player.AbilityInUse(true);
                player.SetMyAnimator("StartDefense");

                if (abilityEffectPrefab)
                {
                    activeAbilityEffect = Instantiate(abilityEffectPrefab, player.transform.position, Quaternion.identity);
                    activeAbilityEffect.transform.parent   = player.transform;
                    activeAbilityEffect.transform.position = player.transform.position;
                }

                DisableAbilityLabels();
            }
            break;

            case AbilityType.dodge: {
                abilityActive = true;
                HealthBehavior playerHealth = player.GetComponent <HealthBehavior>();
                playerHealth.SetAbsorbAttack(true, potency);
                player.AbilityInUse(true);
                player.SetMyAnimator("Dodge");
                DisableAbilityLabels();
            }
            break;

            case AbilityType.stun: {
                abilityActive = true;
                OffenseBehavior playerOffense = player.GetComponent <OffenseBehavior>();
                playerOffense.AbilityAttack(abilityType, potency);
                player.SetMyAnimator("stunAttack");
                DisableAbilityLabels();
                coolDownTime = Mathf.Clamp(coolDownTime + 1f, 1f, 10f);
            }
            break;

            default: { Debug.Log("Ability was not specified. cannot be used."); }
            break;
            }

            if (coolDownTime > 0)
            {
                StartCoroutine(CoolDownAbility(coolDownTime));
            }
        }
    }
    public void CancelAbility(string cancelType)
    {
        if (abilityActive && !isCoolingDown)
        {
            switch (abilityType)
            {
            case AbilityType.defense: {
                abilityActive = false;
                HealthBehavior playerHealth = player.GetComponent <HealthBehavior>();
                playerHealth.EnableBlockDamage(false);
                player.AbilityInUse(false);
                player.SetMyAnimator("EndDefense");
                EnableAbilityLabels();
            }
            break;

            case AbilityType.dodge: {
                if (cancelType.Equals("dodge"))
                {
                    abilityActive = false;
                    HealthBehavior playerHealth = player.GetComponent <HealthBehavior>();
                    playerHealth.SetAbsorbAttack(false, 0);
                    player.AbilityInUse(false);
                    EnableAbilityLabels();
                }
            }
            break;

            case AbilityType.stun: {
                abilityActive = false;
                OffenseBehavior playerOffense = player.GetComponent <OffenseBehavior>();
                EnableAbilityLabels();
            }
            break;
            }

            if (activeAbilityEffect)
            {
                Destroy(activeAbilityEffect);
            }
        }
    }
 public void SpecialAbilityCancel()
 {
     if (abilityActive)
     {
         switch (abilityType)
         {
         case AbilityType.dodge: {
             if (!isCoolingDown)
             {
                 abilityActive = false;
                 EnableAbilityLabels();
             }
             HealthBehavior playerHealth = player.GetComponent <HealthBehavior>();
             playerHealth.SetAbsorbAttack(false, 0);
             player.AbilityInUse(false);
         }
         break;
         }
     }
 }