Esempio n. 1
0
        /// <summary>
        /// 2つのステートを結んでいる全てのトランジション。
        /// </summary>
        /// <param name="path_src">"Base Layer.JMove.JMove0" といった文字列</param>
        public static List <AnimatorStateTransition> FetchTransition_SrcDst(AnimatorController ac, string path_src, string path_dst)
        {
            List <AnimatorStateTransition> hit = new List <AnimatorStateTransition>();

            AnimatorState state_src;
            {
                int            caret = 0;
                FullpathTokens ft    = new FullpathTokens();
                if (!FullpathSyntaxP.Fixed_LayerName_And_StatemachineNames_And_StateName(path_src, ref caret, ref ft))
                {
                    throw new UnityException("Parse failure. [" + path_src + "] ac=[" + ac.name + "]");
                }
                state_src = AconFetcher.FetchState(ac, ft);
            }
            AnimatorState state_dst;

            {
                int            caret = 0;
                FullpathTokens ft    = new FullpathTokens();
                if (!FullpathSyntaxP.Fixed_LayerName_And_StatemachineNames_And_StateName(path_dst, ref caret, ref ft))
                {
                    throw new UnityException("Parse failure. [" + path_dst + "] ac=[" + ac.name + "]");
                }
                state_dst = AconFetcher.FetchState(ac, ft);
            }

            foreach (AnimatorStateTransition transition in state_src.transitions)
            {
                if (transition.destinationState == state_dst)
                {
                    hit.Add(transition);
                }
            }
            return(hit);
        }
Esempio n. 2
0
        public static AnimatorStateTransition FetchTransition_ByFullpath(AnimatorController ac, string fullpath, int transitionNum_ofFullpath)
        {
            int            caret = 0;
            FullpathTokens ft    = new FullpathTokens();

            if (!FullpathSyntaxP.Fixed_LayerName_And_StatemachineNames_And_StateName(fullpath, ref caret, ref ft))
            {
                throw new UnityException("Parse failure. [" + fullpath + "] ac=[" + ac.name + "]");
            }

            AnimatorState state = AconFetcher.FetchState(ac, ft);

            if (null == state)
            {
                throw new UnityException("Not found state. [" + fullpath + "] ac=[" + ac.name + "]");
            }

            int tNum = 0;

            foreach (AnimatorStateTransition transition in state.transitions)
            {
                if (transitionNum_ofFullpath == tNum)
                {
                    return(transition);
                }
                tNum++;
            }

            return(null);// TODO:
        }