/// <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); }
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: }
public static PositionRecord.PositionWrapper FetchPosition_OfState(AnimatorController ac, string fullpath, string propertyname_ofFullpath) { AnimatorStateMachine parentStatemachine; // 構造体 ChildAnimatorState caState = AconFetcher.FetchChildstate(ac, fullpath, out parentStatemachine); return(AconFetcher.FetchPosition_OfState(parentStatemachine, caState, propertyname_ofFullpath)); }
public static PositionRecord.PositionWrapper FetchPosition(AnimatorController ac, AnimatorControllerLayer layer, List <string> statemachineNamesEndsWithoutDot, string propertyname_ofFullpath) { AnimatorStateMachine statemachine = AconFetcher.FetchStatemachine(ac, statemachineNamesEndsWithoutDot, layer); if (null == statemachine) { throw new UnityException("Not found statemachine. [" + string.Join("][", statemachineNamesEndsWithoutDot.ToArray()) + "] ac=[" + ac.name + "]"); } return(AconFetcher.FetchPosition(statemachine, propertyname_ofFullpath)); }
public static ConditionRecord.AnimatorConditionWrapper FetchCondition(AnimatorController ac, DataManipulationRecord request) { AnimatorStateTransition transition = AconFetcher.FetchTransition(ac, request); if (null != transition) { return(AconFetcher.FetchCondition(ac, request)); } return(null); }
/// <summary> /// パス・トークンを指定すると ステートを返す。 /// </summary> public static AnimatorState FetchState(AnimatorController ac, FullpathTokens ft) { AnimatorControllerLayer layer = AconFetcher.FetchLayer_JustLayerName(ac, ft.LayerNameEndsWithoutDot); AnimatorStateMachine currentMachine = layer.stateMachine; if (null == currentMachine) { throw new UnityException("Not found layer. nodes=[" + ft.StatemachinePath + "]"); } // ステートマシンが途中にある場合、最後のステートマシンまで降りていく。 if (0 < ft.StatemachineNamesEndsWithoutDot.Count) { currentMachine = FetchLeafMachine_ofState(currentMachine, ft.StatemachineNamesEndsWithoutDot); if (null == currentMachine) { throw new UnityException("Not found node. currentMachine.name=[" + currentMachine.name + "] nodes=[" + ft.StatemachinePath + "]"); } } return(FetchChildState_ofState(currentMachine, ft.StateName)); }
public static PositionRecord.PositionWrapper FetchPosition(AnimatorController ac, string layerNameEndsWithoutDot, List <string> statemachineNamesEndsWithoutDot, string propertyname_ofFullpath) { AnimatorControllerLayer layer = AconFetcher.FetchLayer_JustLayerName(ac, layerNameEndsWithoutDot); return(FetchPosition(ac, layer, statemachineNamesEndsWithoutDot, propertyname_ofFullpath)); }