コード例 #1
0
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            Playable result;

            if (this.clip == null || this.clip.legacy)
            {
                result = Playable.Null;
            }
            else
            {
                AnimationClipPlayable animationClipPlayable = AnimationClipPlayable.Create(graph, this.m_Clip);
                this.m_AnimationClipPlayable = animationClipPlayable;
                this.m_AnimationClipPlayable.SetRemoveStartOffset(this.removeStartOffset);
                Playable playable = animationClipPlayable;
                if (this.applyRootMotion)
                {
                    AnimationOffsetPlayable animationOffsetPlayable = AnimationOffsetPlayable.Create(graph, this.m_Position, this.m_Rotation, 1);
                    graph.Connect <AnimationClipPlayable, AnimationOffsetPlayable>(animationClipPlayable, 0, animationOffsetPlayable, 0);
                    animationOffsetPlayable.SetInputWeight(0, 1f);
                    playable = animationOffsetPlayable;
                }
                this.LiveLink();
                result = playable;
            }
            return(result);
        }
コード例 #2
0
        private Playable ApplyTrackOffset(PlayableGraph graph, Playable root)
        {
            Playable result;

            if (!this.m_ApplyOffsets)
            {
                result = root;
            }
            else
            {
                AnimationOffsetPlayable animationOffsetPlayable = AnimationOffsetPlayable.Create(graph, this.m_Position, this.m_Rotation, 1);
                graph.Connect <Playable, AnimationOffsetPlayable>(root, 0, animationOffsetPlayable, 0);
                animationOffsetPlayable.SetInputWeight(0, 1f);
                result = animationOffsetPlayable;
            }
            return(result);
        }