public void RegisterEffect(Effect e) { if (effects.ContainsKey(e)) { return; } effects.Add(e, TimeSpan.FromSeconds(Time.timeSinceLevelLoad)); e.Start(world); }
public void DisplayEffect(Effect effect) { var slot = FindLeftestEmptySlot(); if(slot != null) slot.DisplayEffect(effect); slot.DisplayEffect(effect); }
public void HideEffect(Effect effect) { // make copy var effects = new List<Effect>(); effects.AddRange(_iconSlots.Where(x => x.IsOccupied).Select(x => x.ActiveEffect)); effects.Remove(effect); foreach (var slot in _iconSlots) { slot.Clear(); } foreach (var e in effects) { DisplayEffect(e); } }
public DelayedEffect(Effect effect, TimeSpan delay) { this.effect = effect; this.Duration = delay; }
private void InvokeEffectExpired(Effect effect) { var handler = EffectExpired; if (handler == null) { return; } var e = new EffectEventArgs(new[]{effect}); handler(this, e); }
public bool CanRegisterEffect(Effect effect) { return effect.IsStackable || effects.Keys.FirstOrDefault(x => x.GetType() == effect.GetType()) == null; }