void UpdateAbilityState()
    {
        if (_cooldownTimer > 0)
        {
            // Segmenting this timner allows for abilities to be expressly canceled by damage/other systems
            if (_cooldownTimer > _cooldownMinusCast)
            {
                _cooldownTimer = BasicCounter.TowardsTarget(_cooldownTimer, _cooldownMinusCast, 1f);

                if (_cooldownTimer == _cooldownMinusCast)
                {
                    UseAbilityStop?.Invoke();
                    EquippedAbility.Use(transform, CurrentTarget);
                }
            }

            // finished countdown
            else if (_cooldownTimer <= _cooldownMinusCast)
            {
                _cooldownTimer = BasicCounter.TowardsTarget(_cooldownTimer, 0, 1f);
            }

            Cooldown?.Invoke(_cooldownTimer, EquippedAbility.cooldown);
        }
    }
Example #2
0
 public void UseDefaultAbility()
 {
     EquippedAbility.Use(this.transform);
 }