/// <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(); }
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)); } }
public void RemoveEffect(Data.Effect effect) { AppliedEffectSystem.RemoveEffect(effect); EffectRemoved?.Invoke(effect); }
protected void Remove() { EffectRemoved?.Invoke(this, EventArgs.Empty); }