How stoper one annimation model on XNA?

Posted by Mehdi Bugnard on Game Development See other posts from Game Development or by Mehdi Bugnard
Published on 2012-12-15T15:02:35Z Indexed on 2012/12/15 17:18 UTC
Read the original article Hit count: 305

Filed under:
|
|
|
|

I met a Difficulty for one stoper annimation. Everything works great starter for the animation. But I do not see how stoper and can continue the annimation paused. The "animationPlayer.StartClip (clip)" is used to choke the annimation but impossible to find a way to stoper

Thans's a lot

Here is my code to use.

    protected override void LoadContent()
        {
            //Model - Player
            model_player = Content.Load<Model>("Models\\Player\\models");
            // Look up our custom skinning information.
            SkinningData skinningData = model_player.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip = skinningData.AnimationClips["ArmLowAction_006"];

            animationPlayer.StartClip(clip);

}

protected overide update(GameTime gameTime)
{
            KeyboardState key = Keyboard.GetState();

            //  If player don't move -> stop anim 
            if (!key.IsKeyDown(Keys.W) && !keyStateOld.IsKeyUp(Keys.S) &&           !keyStateOld.IsKeyUp(Keys.A) && !keyStateOld.IsKeyUp(Keys.D))
            {
                //animation stop ? not exist ?
                animationPlayer.Stop();
                isPlayerStop = true;
            }
            else
            {
                if(isPlayerStop == true)
                {
                     isPlayerStop = false;
                     animationPlayer.StartClip(Clip);
            }
}

© Game Development or respective owner

Related posts about XNA

Related posts about c#