private void SetLinesActive(bool active) { if (LineFromOrigin.gameObject.activeSelf == active) { return; } LineFromOrigin.SetActive(active); LineToRadial.SetActive(active); }
private void BuildBranch() { var fromOriginObj = new GameObject("BranchLine", typeof(Image)); var fromOriginImage = fromOriginObj.GetComponent <Image>(); fromOriginImage.color = Origin.GetComponent <Image>().color; // Build the line that comes from the origin point. LineFromOrigin = fromOriginObj.GetComponent <RectTransform>(); LineFromOrigin.name = nameof(LineFromOrigin); LineFromOrigin.SetParent(Origin); LineFromOrigin.localScale = Vector3.one; LineFromOrigin.sizeDelta = lineSize; LineFromOrigin.pivot = new Vector2(1f, 0.5f); var originWidth = Origin.rect.width / 2; LineFromOrigin.anchoredPosition = new Vector2(-originWidth, 0); // Copy the previous line and use it as the angled branch. LineToRadial = Instantiate(LineFromOrigin, transform); LineToRadial.name = nameof(LineToRadial); }