Пример #1
0
 void Start()
 {
     //为特定模型添加AvatarObject
     avatar = target.AddComponent <Avatar.AvatarObject>();
     //设置脸变化时间
     avatar.ChangeTime = 2f;
     //注册脸部加载结果事件
     avatar.LoadResultEvent += (done) => avatarInfo = "加载" + (done ? "成功" : "失败");
     //打开AvatarLog日志
     Avatar.AvatarDebug.Enable = true;
     //删除AvatarLog旧日志
     Avatar.AvatarDebug.Delete();
     //注册AvatarLog事件
     Avatar.AvatarDebug.LogEvent += (log, stack, type) => this.log = log;
     //初始化
     tex = new Texture2D(0, 0);
 }
Пример #2
0
        internal AvatarData(AvatarObject avatar)
        {
            DateTime time = DateTime.Now;

            GUID          = "avatar" + time.Day + time.Hour + time.Minute + time.Second;
            AvatarName    = "小酷";
            FaceBonesData = avatar.FaceData.DataBones;
            if (avatar.FaceData.DataImage)
            {
                FaceImageData = avatar.FaceData.DataImage.EncodeToPNG();
            }
            Gender     = avatar.Gender;
            Age        = avatar.Age;
            Hair       = new SkinnedInfo(avatar.Hair);
            UpperBody  = new SkinnedInfo(avatar.UpperBody);
            UpperCloth = new SkinnedInfo(avatar.UpperCloth);
            LowerBody  = new SkinnedInfo(avatar.LowerBody);
            LowerCloth = new SkinnedInfo(avatar.LowerCloth);
            Shoes      = new SkinnedInfo(avatar.Shoes);
        }