static public int get_clipLength(IntPtr l)
 {
     try {
         Game.StateClipPair self = (Game.StateClipPair)checkSelf(l);
         pushValue(l, self.clipLength);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         Game.StateClipPair o;
         o = new Game.StateClipPair();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_clipLength(IntPtr l)
 {
     try {
         Game.StateClipPair self = (Game.StateClipPair)checkSelf(l);
         System.Single      v;
         checkType(l, 2, out v);
         self.clipLength = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_stateName(IntPtr l)
 {
     try {
         Game.StateClipPair self = (Game.StateClipPair)checkSelf(l);
         System.String      v;
         checkType(l, 2, out v);
         self.stateName = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public StateClipPair findClip(string clipName)
 {
     #if UNITY_EDITOR
     if (LBootApp.Running)
     {
         return(null);
     }
     StateClipPair pair = null;
     dict.TryGetValue(clipName, out pair);
     return(pair);
     #endif
     return(null);
 }
        public void Populate()
        {
            if (LBootApp.Running)
            {
                return;
            }

            var animator = GetComponent <Animator>();

            if (animator == null)
            {
                return;
            }
            if (animator.runtimeAnimatorController == null)
            {
                return;
            }

            var stateClipList = new List <StateClipPair>();

            // if (this.gameObject)
            // {
            //     LogUtil.Debug("Populate animator " + this.gameObject.name);
            // }
            // else
            // {
            //     LogUtil.Debug("Populate animator unknown");
            // }

            var controller = animator.runtimeAnimatorController;
            var editorAnimatorController = controller as UnityEditor.Animations.AnimatorController;

            if (editorAnimatorController.layers.Length == 0)
            {
                return;
            }

            var layer = editorAnimatorController.layers.ElementAt(0);
            var sm    = layer.stateMachine;

            int i = 0;

            foreach (var child in sm.states)
            {
                var pair   = new StateClipPair();
                var state  = child.state;
                var motion = state.motion;
                if (motion != null)
                {
                    // AnimationClip clip = null;
                    // foreach (var clip2 in editorAnimatorController.animationClips)
                    // {
                    //     if (clip2.name == motion.name)
                    //     {
                    //         clip = clip2;
                    //     }
                    // }
                    var clip = motion as AnimationClip;
                    pair.stateName     = state.name;
                    pair.clipName      = clip.name;
                    pair.clipLength    = clip.length;
                    pair.clipFrameRate = clip.frameRate;
                    stateClipList.Add(pair);
                    i++;
                }
            }

            this.stateClipPairs = stateClipList.ToArray();
        }