Example #1
0
        static AEffect GetEffect(TargetEffects target, EffectId effectId)
        {
            if (!EffectsMap.ContainsKey(target))
            {
                EffectsMap.Add(target, new List <AEffect>());
            }

            var effect = EffectsMap[target].Find(e => e.Id == effectId);

            if (effect == null)
            {
                effect = Effects[effectId].Clone();
                EffectsMap[target].Add(effect);
            }
            return(effect);
        }
Example #2
0
        public void Play(TargetEffects target)
        {
            if (target == null || !target.gameObject.activeInHierarchy)
            {
                return;
            }

            Target = target;

            if (IsPlaying)
            {
                Timer.Set(_duration);
            }
            else
            {
                Consts.CourutineHolder.StartCoroutine(CrPlay());
            }
        }
Example #3
0
        public void Set(TargetEffects target, bool isOn)
        {
            if (target == null || !target.gameObject.activeInHierarchy)
            {
                return;
            }

            Target    = target;
            IsPlaying = isOn;

            if (isOn)
            {
                OnEffectStart();
            }
            else
            {
                OnEffectEnd();
            }
        }
Example #4
0
 public static void PlayEffect(TargetEffects target, EffectId effectId)
 => GetEffect(target, effectId).Play(target);
Example #5
0
 public static void SetEffect(TargetEffects target, EffectId effectId, bool isOn)
 => GetEffect(target, effectId).Set(target, isOn);