Ejemplo n.º 1
0
        private void TargetAcquired(AbilityData data)
        {
            if (data.IsCancelled())
            {
                return;
            }

            Mana mana = data.GetUser().GetComponent <Mana>();

            if (!mana.UseMana(manaCost))
            {
                return;
            }

            CooldownStore cooldownStore = data.GetUser().GetComponent <CooldownStore>();

            cooldownStore.StartCooldown(this, cooldownTime);

            foreach (var filterStrategy in filterStrategies)
            {
                data.SetTargets(filterStrategy.Filter(data.GetTargets()));
            }

            foreach (var effect in effectStrategies)
            {
                effect.StartEffect(data, EffectFinished);
            }
        }
Ejemplo n.º 2
0
        public override bool Use(GameObject user)
        {
            Mana mana = user.GetComponent <Mana>();

            if (mana.GetManaPoints() < manaCost)
            {
                return(false);
            }

            CooldownStore cooldownStore = user.GetComponent <CooldownStore>();

            if (cooldownStore.GetTimeRemaining(this) > 0)
            {
                return(false);
            }

            AbilityData data = new AbilityData(user);

            ActionScheduler actionScheduler = user.GetComponent <ActionScheduler>();

            actionScheduler.StartAction(data);

            targetingStrategy.StartTargeting(data, () => TargetAcquired(data));

            return(true);
        }