예제 #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);
        }
예제 #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());
            }
        }
예제 #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();
            }
        }
예제 #4
0
 public static void PlayBuff(TargetBuffs target, BuffId buffId)
 => GetBuff(target, buffId).Play(target);
예제 #5
0
 public static void SetBuff(TargetBuffs target, BuffId buffId, bool isOn)
 => GetBuff(target, buffId).Set(target, isOn);