Пример #1
0
        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;
                }
            }
        }
Пример #2
0
        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);
        }
Пример #3
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);
        }
Пример #4
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);
        }