Example #1
0
    private void ReCreateLink(LinkInfo.LinkType linkType, int siblingIndex, LinkInfo.InCase inCaseValues)
    {
        var linkGameObject = Instantiate(_links[(int)linkType - 1], LinksManager.Instance.InUse.ParentTransform);

        linkGameObject.name = _links[(int)linkType - 1].name;
        linkGameObject.transform.SetSiblingIndex(siblingIndex);
        var linkInfo = linkGameObject.GetComponent <LinkInfo>();

        linkInfo.LayoutElementScript.enabled      = true;
        linkInfo.LinkDragScript.enabled           = false;
        linkInfo.CanvasGroupScript.blocksRaycasts = true;
        if (linkInfo.LinkTypeName == LinkInfo.LinkType.Think ||
            linkInfo.LinkTypeName == LinkInfo.LinkType.Watch)
        {
            var goToDisplay   = linkGameObject.transform.GetChild(1).gameObject;
            var rectTransform = goToDisplay.GetComponent <RectTransform>();
            goToDisplay.SetActive(true);
            rectTransform.offsetMin = Vector2.zero;
            rectTransform.offsetMax = Vector2.zero;
            goToDisplay.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = inCaseValues.Idle.ToString();
            goToDisplay.transform.GetChild(1).GetChild(0).GetComponent <Text>().text = inCaseValues.Attack.ToString();
            goToDisplay.transform.GetChild(2).GetChild(0).GetComponent <Text>().text = inCaseValues.Dodge.ToString();
            linkInfo.InCaseValues = inCaseValues;
        }
        LinksManager.Instance.AddNewLink(siblingIndex, linkGameObject.transform);
    }
Example #2
0
        private static void ProcessInCaseValues(int currentValue, int arrayLength, LinkInfo.LinkType linkTypeName, ref LinkInfo[] dummy)
        {
            switch (linkTypeName)
            {
            case LinkInfo.LinkType.Think:
            case LinkInfo.LinkType.Watch:
                dummy[currentValue + 1] = dummy[CalculateIndex(currentValue + 1, dummy[currentValue].InCaseValues.Idle, arrayLength)];
                break;

            case LinkInfo.LinkType.Attack:
                dummy[currentValue + 1] = dummy[CalculateIndex(currentValue + 1, dummy[currentValue].InCaseValues.Attack, arrayLength)];
                break;

            case LinkInfo.LinkType.Dodge:
                dummy[currentValue + 1] = dummy[CalculateIndex(currentValue + 1, dummy[currentValue].InCaseValues.Dodge, arrayLength)];
                break;
            }
        }