/// <summary> /// 使用传入的actor的换装数据来创建新的预览角色 /// </summary> /// <param name="actor"></param> /// <param name="actionAfterLoad"></param> /// <returns></returns> public static UnitID CreateClientModelByCloneForLua(Actor actor, Action <Actor> actionAfterLoad, bool updateWithRawActor = true, bool isUIModel = true) { if (actor == null || actor.mAvatarCtrl == null) { return(null); } AvatarProperty ap = actor.mAvatarCtrl.GetLatestAvatartProperty(); List <uint> modelList = new List <uint>(); List <uint> fashionList = new List <uint>(); List <uint> suit_effects = null; if (ap != null) { modelList = ap.GetEquipModleIds(); fashionList = ap.GetFashionModleIds(); suit_effects = ap.SuitEffectIds != null ? new List <uint>(ap.SuitEffectIds) : null; } ClientModel client_model = CreateClientModel(actor.TypeIdx, actor.UID.obj_idx, modelList, fashionList, suit_effects, actionAfterLoad, updateWithRawActor, isUIModel); if (client_model == null) { return(null); } ShadowBehavior shadow_behavior = client_model.GetBehavior <ShadowBehavior>(); if (shadow_behavior != null) { shadow_behavior.HideFakeShadow = true; } return(client_model.UID); }
/// <summary> /// 通过actor的avatar数据来创建角色(用于创建上坐骑的角色) /// </summary> /// <param name="actor"></param> /// <param name="actionAfterLoad"></param> /// <returns></returns> public static ClientModel CreateClientModelByClone(Actor actor, Action <Actor> actionAfterLoad) { if (actor == null || actor.mAvatarCtrl == null) { return(null); } AvatarProperty ap = actor.mAvatarCtrl.GetLatestAvatartProperty(); if (ap == null || actor == null) { return(null); } List <uint> suit_effects = ap.SuitEffectIds != null ? new List <uint>(ap.SuitEffectIds) : null; ClientModel cm = CreateClientModel(actor.TypeIdx, actor.UID.obj_idx, ap.GetEquipModleIds(), ap.GetFashionModleIds(), suit_effects, actionAfterLoad); cm.mAvatarCtrl.CloneAvatar(actor); cm.IsRidePlayer = true; //ActorManager.Instance.StartCoroutine(RotineCreateClientModelByClone(actor ,cm, actionAfterLoad)); return(cm); }