Beispiel #1
0
        public CGameplayTagNode(string InTag, CGameplayTagNode InParentNode)
        {
            Tag        = InTag;
            ParentNode = InParentNode;

            List <CGameplayTag> ParentCompleteTags = new List <CGameplayTag>();
            CGameplayTagNode    CurNode            = InParentNode;

            // 只要有父亲node
            while (CurNode.IsValid())
            {
                ParentCompleteTags.Add(CurNode.GetCompleteTag());
                CurNode = CurNode.GetParentTagNode();
            }

            //完整的tag名称
            string CompleteTagString = InTag;

            if (ParentCompleteTags.Count > 0)
            {
                CompleteTagString = string.Format("{0}.{1}", ParentCompleteTags[0].GetTagName(), InTag);
            }

            CGameplayTag tag = new CGameplayTag(CompleteTagString);

            CompleteTagWithParents.GameplayTags.Add(tag);
            CompleteTagWithParents.ParentTags.AddRange(ParentCompleteTags);
        }
        /**
         * 返回直系的父亲
         * calling on x.y will return x
         */
        public CGameplayTag RequestGameplayTagDirectParent(CGameplayTag GameplayTag)
        {
            CGameplayTagNode GameplayTagNode = FindTagNode(GameplayTag);

            if (!GameplayTagNode.IsValid())
            {
                return(null);
            }

            var parent = GameplayTagNode.GetParentTagNode();

            if (parent.IsValid())
            {
                return(parent.GetCompleteTag());
            }
            return(null);
        }