void Awake() { upgradeStats.Id = (transform.GetSiblingIndex() + 1) + (transform.parent.GetSiblingIndex() + 1) * 10 + (transform.parent.parent.GetSiblingIndex() + 1) * 100; parent.Buttons.Add(this); connector = GetComponent <UILineConnector>(); icon.sprite = iconSource; if (connector != null && previousButton.Count > 0) { connector.PrevObj = previousButton[0].transform; } }
UILineRenderer DrawLine(RectTransform start, RectTransform end) { GameObject go = Instantiate(linePrefab.gameObject); UILineConnector connector = go.GetComponent <UILineConnector>(); connector.canvas = content.GetComponent <RectTransform>(); go.transform.SetParent(lineContainer.GetComponent <RectTransform>(), false); UILineRenderer line = go.GetComponent <UILineRenderer>(); line.enabled = true; connector.transforms = new RectTransform[] { start, end }; connector.enabled = true; return(line); }
public void newMapLink(GameObject mapLink, GameObject parentNode, GameObject start, GameObject end, Color defaultColor, Color activeColor) { this.start = start; this.end = end; this.defaultColor = defaultColor; this.activeColor = activeColor; lineObject = GameObject.Instantiate(mapLink, parentNode.transform.parent); //lineObject = new GameObject("Link"); //lineObject.transform.parent = parentNode.transform.parent; lineConnector = lineObject.GetComponent <UILineConnector>(); line = lineConnector.lr; line.color = defaultColor; RectTransform[] points = new RectTransform[] { (RectTransform)start.transform, (RectTransform)end.transform }; lineConnector.transforms = points; }
// Use this for initialization void Start() { m_UILineConnector = FindObjectOfType <UILineConnector>(); quiBut.onClick.AddListener(delegate { m_UILineConnector.ImgQuesButtonCallBack(quiBut, lrPos); }); }