public void Initialize(Color glowColor) { orbDisplay = transform.Find("OrbModel").gameObject; presetPolarTrig = new PolarTrig2D(); customPolarTrig = new PolarTrig2D(); currentBrush = customPolarTrig; UseCustomPolarBrush(true); radius = GetComponent <SphereCollider>().bounds.extents.x; glow = transform.Find("OrbModel").Find("glow").GetComponent <SpriteRenderer>(); glow.color = glowColor; }
public void Init(PolarTrig2D brush) { polarBrush = brush; buttons = new List <Button>(); for (int i = 0; i < transform.childCount; i++) { //assuming this child is a ui element on the window, get the elements parameter key ParameterInput p = transform.GetChild(i).GetComponent <ParameterInput>(); if (p != null) //if it has a ParameterInput, proceed { //find the parameter in this brush that corrisponds to the parameter key for this button FloatParameter f = polarBrush.ParameterMap.GetFloatParameterByKey(p.parameterKey); //if its not boolean then its a floatParameter if (f != null && !p.isBoolen) { Button btn = transform.GetChild(i).Find("Button").GetComponent <Button>(); btn.onClick.RemoveAllListeners(); btn.onClick.AddListener(delegate { OpenParameterWindow(p.parameterKey); }); buttons.Add(btn); continue; } BooleanParameter b = polarBrush.ParameterMap.GetBoolParameterByKey(p.parameterKey); Toggle tog = transform.GetChild(i).GetComponent <Toggle>(); tog.onValueChanged.RemoveAllListeners(); if (p.parameterKey == ParameterDictionary.SyncRadiusKey) { syncToggle = tog; syncToggle.isOn = brush.ParameterMap.GetBoolParameterByKey(ParameterDictionary.SyncRadiusKey).Value; tog.onValueChanged.AddListener(delegate { SetSyncRadius(); }); } } } }