Example #1
0
        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);
        }
Example #2
0
        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);
        }