Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public void Play(TargetBuffs target)
        {
            if (target == null || !target.gameObject.activeInHierarchy)
            {
                return;
            }

            Target = target;

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

            Target    = target;
            IsPlaying = isOn;

            if (isOn)
            {
                OnBuffStart();
            }
            else
            {
                OnBuffEnd();
            }
        }
Esempio n. 4
0
 public static void PlayBuff(TargetBuffs target, BuffId buffId)
 => GetBuff(target, buffId).Play(target);
Esempio n. 5
0
 public static void SetBuff(TargetBuffs target, BuffId buffId, bool isOn)
 => GetBuff(target, buffId).Set(target, isOn);