Exemplo n.º 1
0
        public bool CanUseAbility(System.Type _type)
        {
            if (AllyStamina <= AllyMinStamina)
            {
                return(false);
            }
            AbilityConfig _config = GetAbilityConfig(_type);

            return(_config != null &&
                   AllyStamina >= _config.GetEnergyCost() &&
                   AbilityDictionary[_config].CanUseAbility());
        }
        public virtual void AttemptSpecialAbility(AbilityConfig _config, AbilityBehaviour _behaviour, GameObject target = null)
        {
            var energyCost = _config.GetEnergyCost();

            if (energyCost <= AllyStamina)
            {
                if (_behaviour.CanUseAbility())
                {
                    ConsumeEnergy(energyCost);
                    _behaviour.Use(target);
                }
            }
            else
            {
                audioSource.PlayOneShot(outOfEnergy);
            }
        }