/// <summary>Checks whether zero or max reached events should be called</summary>
        private void CheckZeroMaxEvents(bool currentIsMax, bool currentIsZero)
        {
            //if current was not equal to max before modification but is now equal after modification, on reached max is called
            if (!currentIsMax && Current == max)
            {
                OnReachedMax?.Invoke();
            }

            //if current was not equal to zero before modification but is now equal after modification, on reached zero is called
            if (!currentIsZero && Current == 0f)
            {
                OnReachedZero?.Invoke();
            }
        }
    public void Update()
    {
        //if there are systems with higher priority being modified we dont update
        if (highPrioritySystems.Any(system => system.BeingModified))
        {
            return;
        }

        bool currentIsMax  = current == max;
        bool currentIsZero = current == 0f;

        //let each modifier modify this system and remove it if it is finished giving callbacks if the condition is right
        for (int i = activeModifiers.Count - 1; i >= 0; i--)
        {
            HealthModifier modifier = activeModifiers[i];
            modifier.Modify(this);

            bool finished = modifier.Finished;
            if (finished)
            {
                if (queuedModifiers.Count != 0 && queuedModifiers.Any(m => m.Name == modifier.Name))
                {
                    //if there are queued modifiers an one has the same name as this one, replace this one with the queued one
                    for (int j = queuedModifiers.Count - 1; j >= 0; j--)
                    {
                        if (queuedModifiers[j].Name == modifier.Name)
                        {
                            activeModifiers[i] = queuedModifiers[j];
                            queuedModifiers.RemoveAt(j);
                            break;
                        }
                    }
                }
                else
                {
                    //if this modifier cannot be replaced by a queued one, remove it
                    activeModifiers.RemoveAt(i);
                }

                if (activeModifiers.Count(m => m.Regenerate) == 0 && modifier.Regenerate)
                {
                    Debug.Log("stopped regen");
                    //if there are no more regenerating over time modifiers and this one (which was removed) was, the regeneration has ended
                    OnRegenStop?.Invoke();
                }
                else if (activeModifiers.Count(m => !m.Regenerate) == 0 && !modifier.Regenerate)
                {
                    Debug.Log("stopped decay");
                    //if there are no more decay over time modifiers and this one (which was removed) was, the decaying has ended
                    OnDecayStop?.Invoke();
                }

                if (finished)
                {
                    //if the modifier is finished (and thus removed from the list) it can be cleaned up
                    modifier = null;
                }
            }
        }

        //show feedback of data on healthbar and text if showable
        if (healthBar != null)
        {
            healthBar.fillAmount = current / max;
        }
        if (showText && healthText != null)
        {
            healthText.text = $"{Current}/{max}";
        }

        //if current was not equal to max before modification but is now equal after modification, on reached max is called
        if (!currentIsMax && current == max)
        {
            Debug.Log("reached max");
            OnReachedMax?.Invoke();
        }

        //if current was not equal to zero before modification but is now equal after modification, on reached zero is called
        if (!currentIsZero && current == 0f)
        {
            Debug.Log("reached zero");
            OnReachedZero?.Invoke();
        }
    }