コード例 #1
0
        // STATE METHODS: -------------------------------------------------------------------------

        public void SetState(AnimationClip animationClip, AvatarMask avatarMask,
                             float weight, float transition, float speed, int layer)
        {
            PlayableState prevPlayable;
            PlayableState nextPlayable;

            int insertIndex = this.GetSurroundingStates(layer,
                                                        out prevPlayable,
                                                        out nextPlayable
                                                        );

            if (prevPlayable == null && nextPlayable == null)
            {
                this.states.Add(PlayableStateClip.Create(
                                    animationClip, avatarMask, layer, 0f,
                                    transition, speed, weight,
                                    ref this.graph,
                                    ref this.mixerStatesInput,
                                    ref this.mixerStatesOutput
                                    ));
            }
            else if (prevPlayable != null)
            {
                if (prevPlayable.Layer == layer)
                {
                    prevPlayable.StretchDuration(transition);
                }

                this.states.Insert(insertIndex, PlayableStateClip.CreateAfter(
                                       animationClip, avatarMask, layer, 0f,
                                       transition, speed, weight,
                                       ref this.graph,
                                       prevPlayable
                                       ));
            }
            else if (nextPlayable != null)
            {
                this.states.Insert(insertIndex, PlayableStateClip.CreateBefore(
                                       animationClip, avatarMask, layer, 0f,
                                       transition, speed, weight,
                                       ref this.graph,
                                       nextPlayable
                                       ));
            }
        }
コード例 #2
0
ファイル: PlayableStateClip.cs プロジェクト: Akxiva/GroupGame
        public static PlayableState CreateBefore(
            AnimationClip animationClip, AvatarMask avatarMask, int layer,
            double startTime, float fade, float speed, float weight,
            ref PlayableGraph graph, PlayableBase next)
        {
            PlayableStateClip state = new PlayableStateClip(
                animationClip, avatarMask,
                layer, fade, speed, weight
                );

            AnimationClipPlayable input1 = AnimationClipPlayable.Create(graph, animationClip);

            input1.SetTime(startTime);
            input1.SetSpeed(speed);

            state.Setup(ref graph, ref input1, next);
            return(state);
        }
コード例 #3
0
ファイル: PlayableStateClip.cs プロジェクト: Akxiva/GroupGame
        // STATIC CONSTRUCTORS: -------------------------------------------------------------------

        public static PlayableStateClip Create <TInput0, TOutput>(
            AnimationClip animationClip, AvatarMask avatarMask, int layer,
            double startTime, float fade, float speed, float weight,
            ref PlayableGraph graph, ref TInput0 input0, ref TOutput output)
            where TInput0 : struct, IPlayable
            where TOutput : struct, IPlayable
        {
            PlayableStateClip state = new PlayableStateClip(
                animationClip, avatarMask,
                layer, fade, speed, weight
                );

            AnimationClipPlayable input1 = AnimationClipPlayable.Create(graph, animationClip);

            input1.SetTime(startTime);
            input1.SetSpeed(speed);

            state.Setup(ref graph, ref input0, ref input1, ref output);
            return(state);
        }