void RemoveAnimationState(AnimationState state)
        {
            if (!state)
            {
                return;
            }

            // Model mode
            AnimatedModel model = GetComponent <AnimatedModel>();

            if (model)
            {
                model.RemoveAnimationState(state);
                return;
            }

            // Node hierarchy mode
            for (int i = 0; i < nodeAnimationStates_.Count; i++)
            {
                if (nodeAnimationStates_[i] == state)
                {
                    nodeAnimationStates_.RemoveAt(i);
                    return;
                }
            }
        }
        AnimationState AddAnimationState(Animation animation)
        {
            if (!animation)
            {
                return(null);
            }

            // Model mode
            AnimatedModel model = GetComponent <AnimatedModel>();

            if (model)
            {
                return(model.AddAnimationState(animation));
            }

            // Node hierarchy mode
            AnimationState newState = new AnimationState(node_, animation);

            nodeAnimationStates_.Push(newState);
            return(newState);
        }
        public AnimationState GetAnimationState(int nameHash)
        {
            // Model mode
            AnimatedModel model = GetComponent <AnimatedModel>();

            if (model)
            {
                return(model.GetAnimationState(nameHash));
            }

            // Node hierarchy mode
            foreach (var i in nodeAnimationStates_)
            {
                Animation animation = i.Animation;
                if (animation.NameHash == nameHash)// || animation.AnimationNameHash == nameHash)
                {
                    return(i);
                }
            }

            return(null);
        }
        public bool SetStartBone(string name, string startBoneName)
        {
            // Start bone can only be set in model mode
            AnimatedModel model = GetComponent <AnimatedModel>();

            if (!model)
            {
                return(false);
            }

            AnimationState state = model.GetAnimationState(name);

            if (!state)
            {
                return(false);
            }

            Bone bone = model.Skeleton.GetBone(startBoneName);

            state.SetStartBone(bone);

            return(true);
        }