Ejemplo n.º 1
0
    // Creates a path segment going into or out of the given transform (isEntryBranch specifies which)
    private void CreateBranch(StageNode stage, bool isEntryBranch)
    {
        float         branchWidth = _horizontalPadding / 2;
        RectTransform branch      = Instantiate(_pathPrefab, stage.transform).GetComponent <RectTransform>();

        branch.sizeDelta = new Vector2(branchWidth + branch.rect.height, branch.rect.height);
        if (isEntryBranch)
        {
            branch.anchoredPosition -= new Vector2(branchWidth / 2, 0);
            stage.SetEntryBranch(branch.gameObject);
        }
        else
        {
            branch.anchoredPosition += new Vector2(branchWidth / 2, 0);
        }
    }