void MaxSliderChanged() { if (minSlider.value > maxSlider.value) { minSlider.value = maxSlider.value; } UpdateSliders(); currentParameter.SetMax(maxSlider.value); }
public void SetParameterValues(FloatParameter f) { FloatParameter param = parameterMap.GetFloatParameterByKey(f.ParamKey); if (param == null) { return; } param.SetMin(f.Min); param.SetMax(f.Max); param.SetRate(f.Rate); param.SetOffset(f.Offset); param.SetRandom(f.Randomness); param.SetCyclical(f.IsCyclical); param.SetAscend(f.Ascend); param.SetStartAscending(f.StartAscending); }
public void LoadPresetToOrb(string presetName, Orb orb) { orb.presetName = presetName; string[] lines = File.ReadAllLines(PresetDirectory + "/" + presetName); for (int i = 0; i < lines.Length; i++) { //float parameter if (lines[i][0] == 'f') { lines[i] = RemoveNextComma(lines[i]); //key int nextValLength = lines[i].IndexOf(','); int key; if (!int.TryParse(lines[i].Substring(0, nextValLength), out key)) { Debug.Log("Key"); } lines[i] = RemoveNextComma(lines[i]); //min nextValLength = lines[i].IndexOf(','); float min; if (!float.TryParse(lines[i].Substring(0, nextValLength), out min)) { Debug.Log("Min"); } //max lines[i] = RemoveNextComma(lines[i]); nextValLength = lines[i].IndexOf(','); float max; if (!float.TryParse(lines[i].Substring(0, nextValLength), out max)) { Debug.Log("Max"); } //rate lines[i] = RemoveNextComma(lines[i]); nextValLength = lines[i].IndexOf(','); float rate; if (!float.TryParse(lines[i].Substring(0, nextValLength), out rate)) { Debug.Log("Rate"); } //offset lines[i] = RemoveNextComma(lines[i]); nextValLength = lines[i].IndexOf(','); float offset; if (!float.TryParse(lines[i].Substring(0, nextValLength), out offset)) { Debug.Log("Offset"); } //random lines[i] = RemoveNextComma(lines[i]); nextValLength = lines[i].IndexOf(','); float rand; if (!float.TryParse(lines[i].Substring(0, nextValLength), out rand)) { Debug.Log("Rand"); } //cyclical lines[i] = RemoveNextComma(lines[i]); nextValLength = lines[i].IndexOf(','); bool cyclical = lines[i].Substring(0, nextValLength).ToLower() == "true"; //startAsc lines[i] = RemoveNextComma(lines[i]); nextValLength = lines[i].IndexOf(','); bool startAscending = lines[i].Substring(0, nextValLength).ToLower() == "true"; //Ascend lines[i] = RemoveNextComma(lines[i]); nextValLength = lines[i].IndexOf(','); bool ascend = lines[i].Substring(0, nextValLength).ToLower() == "true"; FloatParameter parameter = orb.CurrentBrush.ParameterMap.GetFloatParameterByKey(key); if (parameter == null) { Debug.Log("Param not found"); return; } parameter.SetMin(min); parameter.SetMax(max); parameter.SetRate(rate); parameter.SetOffset(offset); parameter.SetRandom(rand); parameter.SetCyclical(cyclical); parameter.SetStartAscending(startAscending); parameter.SetAscend(ascend); } //bool param else if (lines[i][0] == 'b') { } } }