static ABuff GetBuff(TargetBuffs target, BuffId buffId) { if (!BuffsMap.ContainsKey(target)) { BuffsMap.Add(target, new List <ABuff>()); } var buff = BuffsMap[target].Find(b => b.Id == buffId); if (buff == null) { buff = Buffs[buffId].Clone(); BuffsMap[target].Add(buff); } return(buff); }
public void Play(TargetBuffs target) { if (target == null || !target.gameObject.activeInHierarchy) { return; } Target = target; if (IsPlaying) { Timer.Set(_duration); } else { Consts.CourutineHolder.StartCoroutine(CrPlay()); } }
public void Set(TargetBuffs target, bool isOn) { if (target == null || !target.gameObject.activeInHierarchy) { return; } Target = target; IsPlaying = isOn; if (isOn) { OnBuffStart(); } else { OnBuffEnd(); } }
public static void PlayBuff(TargetBuffs target, BuffId buffId) => GetBuff(target, buffId).Play(target);
public static void SetBuff(TargetBuffs target, BuffId buffId, bool isOn) => GetBuff(target, buffId).Set(target, isOn);