예제 #1
0
        public void AddClock(BuffClock clock)
        {
            Clocks.Add(clock);

            Action removeCallback = null;

            removeCallback = () =>
            {
                Clocks.Remove(clock);

                clock.StackSize.OnValueChanged -= RecalculateStackSizeCallback;
                clock.OnRemove -= removeCallback;
                clock.OnTick   -= OnTick;

                if (Clocks.Count == 0)
                {
                    RemoveBuff();
                }
                else
                {
                    RecalculateStackSize();
                }
            };

            clock.StackSize.OnValueChanged += RecalculateStackSizeCallback;
            clock.OnRemove += removeCallback;
            clock.OnTick   += OnTick;

            RecalculateStackSizeCallback(0);
        }
예제 #2
0
파일: Buff.cs 프로젝트: sishui/RPGCore
        public void Update(float deltaTime)
        {
            for (int i = Clocks.Count - 1; i >= 0; i--)
            {
                BuffClock clock = Clocks[i];

                clock.Update(deltaTime);
            }
        }
예제 #3
0
        public Buff(BuffTemplate _buffTemplate, RPGCharacter _target, BuffClock baseClock)
        {
            buffTemplate = _buffTemplate;
            buffTemplate.SetupGraph(this);

            buffInput = buffTemplate.GetNode <BuffInputNode>();
            buffInput.Target.GetEntry(this).Value = _target;

            AddClock(baseClock);

            BaseStackSize.onChanged += RecalculateStackSize;

            OnRemove += () =>
            {
                buffTemplate.RemoveGraph(this);
            };
            buffInput.SetTarget(this, this);
        }
예제 #4
0
 public void RemoveClock(BuffClock clock)
 {
     clock.OnTick -= OnTick;
     clock.RemoveClock();
 }