Example #1
0
    public void OnBuffTimerTick(TimedAttributeModifier modifier)
    {
        int increment = 0;

        if (modifier.BuffApplyMethod == BuffApplyMethodType.Ramp)
        {
            increment = 1;
        }
        else if (modifier.BuffApplyMethod == BuffApplyMethodType.Tick)
        {
            increment = modifier.GetValue(GetBaseValue(modifier.AttrValueType));
        }

        IncrementValue(increment, modifier.AttrValueType);
        EventManager.Instance.InvokeEvent(EventName.AttributesUpdated, new AttributesUpdatedEventArgs());
    }
Example #2
0
    public void OnBuffTimerFinished(TimedAttributeModifier modifier, BuffTimer timer)
    {
        timer.TimerFinished -= OnBuffTimerFinished;
        timer.TimerTick     -= OnBuffTimerTick;

        if (modifier.BuffApplyMethod == BuffApplyMethodType.Ramp)
        {
            IncrementValue(-modifier.GetValue(GetBaseValue(modifier.AttrValueType)), modifier.AttrValueType);
            modifier = new TimedAttributeModifier(modifier)
            {
                BuffApplyMethod = BuffApplyMethodType.Hold
            };
            modifier.SetTimer(timer, this);
        }
        else
        {
            RemoveModifier(modifier);
            GameObject.Destroy(timer);
        }
        EventManager.Instance.InvokeEvent(EventName.AttributesUpdated, new AttributesUpdatedEventArgs());
    }