Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public void Update(float deltaTime)
        {
            for (int i = Clocks.Count - 1; i >= 0; i--)
            {
                BuffClock clock = Clocks[i];

                clock.Update(deltaTime);
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
 public void RemoveClock(BuffClock clock)
 {
     clock.OnTick -= OnTick;
     clock.RemoveClock();
 }