Пример #1
0
 public void RegisterEffect(Effect e)
 {
     if (effects.ContainsKey(e)) {
         return;
     }
     effects.Add(e, TimeSpan.FromSeconds(Time.timeSinceLevelLoad));
     e.Start(world);
 }
Пример #2
0
        public void DisplayEffect(Effect effect)
        {
            var slot = FindLeftestEmptySlot();

            if(slot != null)
                slot.DisplayEffect(effect);

            slot.DisplayEffect(effect);
        }
Пример #3
0
        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);
            }
        }
Пример #4
0
 public DelayedEffect(Effect effect, TimeSpan delay)
 {
     this.effect = effect;
     this.Duration = delay;
 }
Пример #5
0
        private void InvokeEffectExpired(Effect effect)
        {
            var handler = EffectExpired;
            if (handler == null) {
                return;
            }

            var e = new EffectEventArgs(new[]{effect});
            handler(this, e);
        }
Пример #6
0
 public bool CanRegisterEffect(Effect effect)
 {
     return effect.IsStackable || effects.Keys.FirstOrDefault(x => x.GetType() == effect.GetType()) == null;
 }