示例#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();
 }