コード例 #1
0
        //load the avatar
        public Avatar(ContentRegister content, UpdateManager update)
        {
            //create a random avatar description...
            Microsoft.Xna.Framework.GamerServices.AvatarDescription description;
            description = Microsoft.Xna.Framework.GamerServices.AvatarDescription.CreateRandom();

            //Create the avatar instance
            avatar = new AvatarInstance(description, true);


            //Create the animation controller.
            animationController = avatar.GetAnimationController();

            //NOTE: Animations cannot be played until the avatar animation data has been loaded...
            content.Add(this);             // this will call LoadContent
            update.Add(this);

            //At this point in this tutorial, the animation is now loaded.

            //get the index of the walk animation
            int animationIndex = animationController.AnimationIndex("Walk");

            //begin playing the animation, looping
            walkAnimation = animationController.PlayLoopingAnimation(animationIndex);
        }