Exemplo n.º 1
0
        /// <summary>
        /// Remove an active effect
        /// </summary>
        /// <param name="effect"></param>
        public void RemoveEffect(StatEffect effect)
        {
            if (!Effects.Contains(effect))
            {
                foreach (StatEffect fx in Effects)
                {
                    if (fx.name == effect.name)
                    {
                        RemoveEffect(fx);
                        return;
                    }
                }

                return;
            }

            if (!effect.isRemoveable)
            {
                return;
            }

            StatValue             stat;
            List <DamageModifier> modifiers;

            // Find modifier targets
            foreach (StatModifier mod in effect.modifiers)
            {
                stat = FindStat(mod.affectedStat);
                if (stat != null)
                {
                    stat.RemoveModifier(mod);
                }
                modifiers = FindDamageModifiers(mod.affectedStat);
                foreach (DamageModifier dm in modifiers)
                {
                    dm.RemoveModifier(mod);
                }
            }

            if (effect.effectParticles != null)
            {
                Destroy(effect.effectParticles);
            }

            Effects.Remove(effect);
            onEffectRemoved?.Invoke(effect);
            effect.onEnd?.Invoke();
        }
Exemplo n.º 2
0
        protected override void UpdateImpl()
        {
            long time = stopwatch.ElapsedMilliseconds;

            for (int i = effects.Count - 1; i >= 0; i--)
            {
                if (time >= effects[i].EndTime)
                {
                    ItemEffect effect = effects[i];
                    effects[i].RemoveEffect();
                    effects.RemoveAt(i);
                    if (EffectRemoved != null)
                    {
                        EffectRemoved.Invoke(effect);
                    }
                }
            }

            for (int i = 0; i < itemSprite.ChildrenCount; i++)
            {
                var pic = itemSprite[i] as PictureObject;
                itemSprite[i].Position = new SharpDX.Vector2(AnimationUtility.GetAnimationValue(itemSprite[i].Position.X, 11 + i * 19), itemSprite[i].Position.Y);
                itemSprite[i].Alpha    = AnimationUtility.IncreaseAlpha(itemSprite[i].Alpha);
                pic.Scale = new Vector2(AnimationUtility.IncreaseAlpha(pic.Scale.X));
            }
        }
Exemplo n.º 3
0
        public void RemoveEffect(Data.Effect effect)
        {
            AppliedEffectSystem.RemoveEffect(effect);

            EffectRemoved?.Invoke(effect);
        }
Exemplo n.º 4
0
 protected void Remove()
 {
     EffectRemoved?.Invoke(this, EventArgs.Empty);
 }