共用方式為


Avatar Support Overview (Xbox 360)

Discusses avatars in XNA Game Studio applications targeting the Xbox 360 console. Avatar support includes retrieving existing gamer avatars or creating new ones, and rendering and animating avatars.

Overview

Avatars provide other ways of placing the player in your game. With avatars, you can render and animate the avatar within the game, or you can generate one or more random avatars to use as a crowd backdrop or as additional characters in the game.

You must meet the following requirements before using avatars in your game:

  • The game targets the Xbox 360 platform.

    Note

    Select avatar related methods are avalable on Windows Phone only for titles approved to access Xbox LIVE Services through the Xbox LIVE Registered Developer Program.

  • Gamer services must be initiated. For more information, see the Initialization of Gamer Services section in Introduction to Gamer Services.

The avatar of a signed-in gamer is retreived by the BeginGetFromGamer and EndGetFromGamer methods. Create one or more random avatars using the CreateRandom method. This method creates an AvatarDescription object, initialized with random data. You then can render this avatar with a call to Draw.

XNA Game Studio provides avatar rendering with the AvatarRenderer class, and animation with the AvatarAnimation class. Use IAvatarAnimation if you want to integrate custom avatar animations with standard animations. The renderer uses basic lighting and shading effects. You can invoke the renderer with a single call to AvatarRenderer.Draw. This method also uses an animation to indicate the avatar currently is loading. This is used automatically by the renderer until loading is complete.

Once the avatar is displayed, idle animations cycle randomly unless you specify a specific animation from the standard list. For a complete list, see AvatarAnimationPreset. The AvatarRenderer class contains properties related to the lighting and rendering of the avatar. These properties include, among others, color and direction of directional light, and transformation matrices. For a full listing of these properties, see AvatarRenderer Properties.

See Also

Tasks

Rendering and Animating Avatars (Xbox 360)

Reference

AvatarDescription
AvatarExpression
AvatarRenderer
AvatarAnimation
IAvatarAnimation