Skip to main content

StatsAndEffects.GetValueWithDictionary

Declaration#

public virtual float GetValueWithDictionary(string formula, Dictionary<string, StatSource> sources)

Parameters#

NameDescription
formulaFormula used to get value
sourcesSource used when other: is requested

Description#

Get the value of a formula/expression.

Usage#

Example
using NullSave.GDTK;using NullSave.GDTK.Stats;using System.Collections.Generic;using UnityEngine;
public class Example : MonoBehaviour{
    public void ExampleMethod(StatsAndEffects target)    {        Dictionary<string, StatSource> sources = new Dictionary<string, StatSource>();        sources.Add("", target.source);        sources.Add("global:", ToolRegistry.GetComponent<GlobalStats>()?.source);
        float result = target.GetValueWithDictionary("1 + global:difficulty", sources);    }
}