StatSource.GetValue
Declaration#
public virtual float GetValue(string formula, StatSource other)Parameters#
| Name | Description |
|---|---|
| formula | Formula to solve |
| other | Other Stat Source |
Description#
Get the value of a formula
Usage#
Example
using NullSave.GDTK.Stats;using UnityEngine;
public class Example : MonoBehaviour{
public void ExampleMethod(StatSource source) { // Get the maximum value of a stat name 'HP' and add 3 float value = source.GetValue("HP:max + 3"); }
}Declaration#
public virtual float GetValue(string formula, Dictionary<string, StatSource> sources)Parameters#
| Name | Description |
|---|---|
| formula | Formula to solve |
| sources | Dictionary of other sources |
Description#
Get the value of a formula
Usage#
Example
using NullSave.GDTK;using NullSave.GDTK.Stats;using System.Collections.Generic;using UnityEngine;
public class Example : MonoBehaviour{
public void ExampleMethod(StatSource target) { Dictionary<string, StatSource> sources = new Dictionary<string, StatSource>() { { "", target }, { "global", ToolRegistry.GetComponent<GlobalStats>().source } };
target.GetValue("global:difficulty * 7", sources); }}