private void Populate() { objectPool = new List <Element>(); linePool = new List <LineScript>(); foreach (ElementData ed in GameHandler.dataHandler.GetElementData(currentExpression)) { GameObject go = Instantiate(GameHandler.objectHandler.elements[(int)ed.type], panels); go.transform.localPosition = new Vector3(ed.positionX, ed.positionY, 0.0f); Element e = go.GetComponentInChildren <Element>(); e.SetData(objectPool.Count, this); ReLabel(e); objectPool.Add(e); } int currentElement = 0; foreach (ElementData ed in GameHandler.dataHandler.GetElementData(currentExpression)) { for (int i = 0; i < ed.inputs.Length; i++) { if (ed.inputs[i] != null) { // Add line // TODO - Make special line for bools GameObject go = Instantiate(GameHandler.objectHandler.line, lines); LineScript ls = go.GetComponent <LineScript>(); ls.SetConnect1(objectPool[currentElement].GetHandels()[i]); ls.SetConnect2(objectPool[GameHandler.dataHandler.GetElementInputDestinationIndex(currentExpression, currentElement, i)].GetHandleOut()); ls.SetPlaced(false); } } currentElement++; } }
public void Enter() { if (otherHandle.Count > 0 && (handleType == HandleType.In || handleType == HandleType.BoolIn)) { } else { RectTransform trans = null; if (handleType == HandleType.BoolIn || handleType == HandleType.BoolOut) { trans = Instantiate(GameHandler.objectHandler.line, element.GetCallBack().lines).GetComponent <RectTransform>(); } else { trans = Instantiate(GameHandler.objectHandler.line, element.GetCallBack().lines).GetComponent <RectTransform>(); } trans.transform.position = transform.position; LineScript ls = trans.gameObject.GetComponent <LineScript>(); element.GetCallBack().currentDrawingLine = ls; ls.SetConnect1(this); } }