示例#1
0
        public void Update(float dt)
        {
            if (Anim != null)
            {
                if (playingState == AnimPlayingState.Stopped)
                {
                    return;
                }

                if (playingState == AnimPlayingState.Playing)
                {
                    AnimPos += dt;
                    if (AnimPos > durationInSeconds)
                    {
                        if (Loop)
                        {
                            while (AnimPos > durationInSeconds)
                            {
                                AnimPos -= durationInSeconds;
                            }
                        }
                        else
                        {
                            playingState = AnimPlayingState.Stopped;
                            dt           = AnimPos - durationInSeconds - ENDPOINT_EPSILON;
                            AnimPos      = durationInSeconds;
                        }
                    }
                }
                else if (playingState == AnimPlayingState.PlayingInReverse)
                {
                    dt       = -dt;
                    AnimPos += dt;
                    if (AnimPos < 0.0f)
                    {
                        if (Loop)
                        {
                            while (AnimPos < 0.0f)
                            {
                                AnimPos += durationInSeconds;
                            }
                        }
                        else
                        {
                            playingState = AnimPlayingState.Stopped;
                            dt           = dt - AnimPos + ENDPOINT_EPSILON;
                            AnimPos      = 0.0f;
                        }
                    }
                }

                for (int i = 0; i < Anim.JointAnims.Count; ++i)
                {
                    JointAnimStates[i].Update(dt, ref parentClipInstance.JointStates[JointAnimStates[i].JointAnim.JointId]);
                }
            }
        }
示例#2
0
        public void Play(ClipAnim anim, bool loop, bool forwards)
        {
            Anim              = anim;
            AnimPos           = 0.0f;
            Loop              = loop;
            durationInSeconds = (float)Anim.Duration / Anim.Framerate;
            playingState      = forwards ? AnimPlayingState.Playing : AnimPlayingState.PlayingInReverse;

            for (int i = 0; i < Anim.JointAnims.Count; ++i)
            {
                JointAnimStates[i] = Anim.JointAnims[i].CreateState();
            }
        }
示例#3
0
        public void Play(ClipAnim anim, bool loop, bool forwards)
        {
            Anim = anim;
            AnimPos = 0.0f;
            Loop = loop;
            durationInSeconds = (float)Anim.Duration / Anim.Framerate;
            playingState = forwards ? AnimPlayingState.Playing : AnimPlayingState.PlayingInReverse;

            for (int i = 0; i < Anim.JointAnims.Count; ++i)
            {
                JointAnimStates[i] = Anim.JointAnims[i].CreateState();
            }
        }
示例#4
0
        public void Play(ClipAnim anim, bool loop, bool forwards, float speedMod = 1f)
        {
            System.Diagnostics.Debug.Assert(anim != null);
            System.Diagnostics.Debug.Assert(speedMod > 0.0f);

            Anim              = anim;
            AnimPos           = 0.0f;
            Loop              = loop;
            speedModifier     = speedMod;
            durationInSeconds =
                (1f / speedModifier) * ((float)Anim.Duration / Anim.Framerate);
            playingState = forwards ? AnimPlayingState.Playing : AnimPlayingState.PlayingInReverse;

            for (int i = 0; i < Anim.JointAnims.Count; ++i)
            {
                JointAnimStates[i] = Anim.JointAnims[i].CreateState();
            }
        }
示例#5
0
 public void Stop()
 {
     playingState = AnimPlayingState.Stopped;
 }
示例#6
0
        public void Update(float dt)
        {
            if (Anim != null)
            {
                if (playingState == AnimPlayingState.Stopped)
                    return;

                if (playingState == AnimPlayingState.Playing)
                {
                    AnimPos += dt;
                    if (AnimPos > durationInSeconds)
                    {
                        if (Loop)
                        {
                            while (AnimPos > durationInSeconds)
                                AnimPos -= durationInSeconds;
                        }
                        else
                        {
                            playingState = AnimPlayingState.Stopped;
                            dt = AnimPos - durationInSeconds - ENDPOINT_EPSILON;
                            AnimPos = durationInSeconds;
                        }
                    }
                }
                else if (playingState == AnimPlayingState.PlayingInReverse)
                {
                    dt = -dt;
                    AnimPos += dt;
                    if (AnimPos < 0.0f)
                    {
                        if (Loop)
                        {
                            while (AnimPos < 0.0f)
                                AnimPos += durationInSeconds;
                        }
                        else
                        {
                            playingState = AnimPlayingState.Stopped;
                            dt = dt - AnimPos + ENDPOINT_EPSILON;
                            AnimPos = 0.0f;
                        }
                    }
                }

                for (int i = 0; i < Anim.JointAnims.Count; ++i)
                {
                    JointAnimStates[i].Update(dt, ref parentClipInstance.JointStates[JointAnimStates[i].JointAnim.JointId]);
                }
            }
        }
示例#7
0
        public void Play(ClipAnim anim, bool loop, bool forwards, float speedMod=1f)
        {
            System.Diagnostics.Debug.Assert(anim != null);
            System.Diagnostics.Debug.Assert(speedMod > 0.0f);

            Anim = anim;
            AnimPos = 0.0f;
            Loop = loop;
            speedModifier = speedMod;
            durationInSeconds =
                (1f / speedModifier) * ((float)Anim.Duration / Anim.Framerate);
            playingState = forwards ? AnimPlayingState.Playing : AnimPlayingState.PlayingInReverse;

            for (int i = 0; i < Anim.JointAnims.Count; ++i)
            {
                JointAnimStates[i] = Anim.JointAnims[i].CreateState();
            }
        }
示例#8
0
 public void Stop()
 {
     playingState = AnimPlayingState.Stopped;
 }