FSO.LotView.Components.AvatarComponent.Draw C# (CSharp) Méthode

Draw() public méthode

public Draw ( GraphicsDevice device, WorldState world ) : void
device GraphicsDevice
world WorldState
Résultat void
        public override void Draw(GraphicsDevice device, WorldState world)
        {
            var headpos = Avatar.Skeleton.GetBone("HEAD").AbsolutePosition / 3.0f;
            var transhead = Vector3.Transform(new Vector3(headpos.X, headpos.Z, headpos.Y), Matrix.CreateRotationZ((float)(RadianDirection + Math.PI))) + this.Position - new Vector3(0.5f, 0.5f, 0f);

            if (!Visible) return;

            if (Avatar != null){
                world._3D.DrawMesh(Matrix.CreateRotationY((float)(Math.PI-RadianDirection))*this.World, Avatar, (short)ObjectID, Room,
                    ((DisplayFlags & AvatarDisplayFlags.ShowAsGhost) > 0)?new Color(32, 255, 96)*0.66f:Color.White);
            }

            if (Headline != null)
            {
                var headOff = (transhead-Position) + new Vector3(0,0,0.66f);
                var headPx = world.WorldSpace.GetScreenFromTile(headOff);

                var item = world._2D.NewSprite(_2DBatchRenderMode.Z_BUFFER);
                item.Pixel = Headline;
                item.Depth = TextureGenerator.GetWallZBuffer(device)[30];

                item.SrcRect = new Rectangle(0, 0, Headline.Width, Headline.Height);
                item.WorldPosition = headOff;
                var off = PosCenterOffsets[(int)world.Zoom - 1];
                item.DestRect = new Rectangle(
                    ((int)headPx.X - Headline.Width / 2) + (int)off.X,
                    ((int)headPx.Y - Headline.Height / 2) + (int)off.Y, Headline.Width, Headline.Height);
                item.Room = Room;
                world._2D.Draw(item);
            }
        }