Examples

The following is a simple use of the above.

See the demo scenario StatTest in the example for more usage.

namespace RGame
{
    public class BtnOneParmModify : MonoBehaviour
    {
        public SoleObjectRuntimeValueSO ValueSO;

        public string ValueName;
        public bool IsModifyMaxValue;
        public int ModifyValue;
        
        public FormulaCalSO FormulaSO;
        public string ParameterName;
        
        private Button mButton;

        private Dictionary<string, double> ParameterDic = new Dictionary<string, double>();

        private void Start()
        {
            mButton = GetComponent<Button>();
            
            mButton.onClick.AddListener(() =>
            {
                ParameterDic[ParameterName] = ModifyValue;
                ValueSO.ModifyValue(ValueName,FormulaSO.Evaluate(ValueSO,ParameterDic),IsModifyMaxValue);
            });
        }
    }
}

Mount the script and use it!

Last updated