Пример #1
0
    public override void Execute()
    {
        bool success = ability.Cast(castTo);

        if (success)
        {
            Debug.Log("Ability succeeded.");
        }
        else
        {
            Debug.Log("Out of range!");
        }
    }
        public bool Cast(ICharacterFinder characterFinder, IAbility ability, Vector2 targetPosition)
        {
            if (ActionPoints < ability.ActionPoints)
            {
                return(false);
            }

            bool didCast = ability.Cast(characterFinder, this, targetPosition);

            if (didCast)
            {
                ActionPoints -= ability.ActionPoints;
                AbilityCast?.Invoke(this, ability, targetPosition);
            }

            return(didCast);
        }