public GetLayerName ( int layerIndex ) : string | ||
layerIndex | int | |
Результат | string |
public static float GetLayersWeight(this Animator anim, string strNamePartial) { for (int i = 0; i < anim.layerCount; i++) { string strName = anim.GetLayerName(i); if (!strName.StartsWith(strNamePartial)) { continue; } return(anim.GetLayerWeight(i)); } return(0.0f); }
void Start() { animator = this.GetComponent<Animator>(); if (Fsm!=null) { string layerName = animator.GetLayerName(LayerIndex); fsmStateLUT = new Dictionary<int, FsmState>(); foreach (FsmState state in Fsm.Fsm.States) { string fsmStateName = state.Name; RegisterHash(state.Name,state); if (!fsmStateName.StartsWith(layerName+".")) { RegisterHash(layerName+"."+state.Name,state); } } } }
/// <summary> /// Get all the layer names. /// </summary> /// <returns> /// The layer names. /// </returns> /// <param name='animator'> /// Animator. /// </param> private static string[] GetLayerNames(Animator animator) { // AnimatorController animatorController = animator.runtimeAnimatorController as AnimatorController; List<string> layerNames = new List<string>(); // for (int i = 0; i < animatorController.GetLayerCount(); i++) // layerNames.Add(animatorController.GetLayerName(i)); for (int i = 0; i < animator.layerCount; i++) layerNames.Add(animator.GetLayerName(i)); return layerNames.ToArray(); }