using Microsoft.Xna.Framework; using System.Collections.Generic; using System.Xml.Linq; namespace Subsurface { class DelayedEffect : StatusEffect { public static List list = new List(); float delay; float timer; Vector2 position; List targets; public float Timer { get { return timer; } } public DelayedEffect(XElement element) : base(element) { delay = ToolBox.GetAttributeFloat(element, "delay", 1.0f); } public override void Apply(ActionType type, float deltaTime, Vector2 position, List targets) { if (this.type != type) return; timer = delay; this.position = position; this.targets = targets; list.Add(this); } public void Update(float deltaTime) { timer -= deltaTime; if (timer > 0.0f) return; base.Apply(1.0f, position, targets); list.Remove(this); } } }