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); }
public void Play(TargetEffects target) { if (target == null || !target.gameObject.activeInHierarchy) { return; } Target = target; if (IsPlaying) { Timer.Set(_duration); } else { Consts.CourutineHolder.StartCoroutine(CrPlay()); } }
public void Set(TargetEffects target, bool isOn) { if (target == null || !target.gameObject.activeInHierarchy) { return; } Target = target; IsPlaying = isOn; if (isOn) { OnEffectStart(); } else { OnEffectEnd(); } }
public static void PlayEffect(TargetEffects target, EffectId effectId) => GetEffect(target, effectId).Play(target);
public static void SetEffect(TargetEffects target, EffectId effectId, bool isOn) => GetEffect(target, effectId).Set(target, isOn);