/// <summary> /// 重新实例化坐骑 /// </summary> protected virtual void ReBuildMount() { if (myMount != null) { if (myMount.isDownloading) { myMount.CancelDownLoad(); } Destroy(myMount); animationRoot.parent = this.transform; animationRoot.localPosition = Vector3.zero; animationRoot.localEulerAngles = Vector3.zero; } if (typeID == ObjectType.PreviewPlayer) { return; } if (actorInfo.CurMountInfo == null) { return; } myMount = Mount.CreateDummy(actorInfo.CurMountInfo); myMount.transform.parent = this.transform; myMount.transform.localPosition = Vector3.zero; myMount.transform.localScale = Vector3.one; myMount.transform.localEulerAngles = Vector3.zero; myMount.StartAsyncCreate((x, y) => { if (y == EResult.Success) { x.gameObject.SetMaskLayer(this.gameObject.layer); if (actorInfo.CurMountInfo.IsRiding) { GameObject ass = Mount.AssPositionObj(x.gameObject, actorInfo.CurMountInfo.SeatPointName); if (ass != null) { animationRoot.parent = ass.transform; animationRoot.localPosition = Vector3.zero; animationRoot.localEulerAngles = Vector3.zero; } else { Debug.LogError("坐骑资源上找不到挂点!"); } if (headTextCtrl != null) { headTextCtrl.CaculatPos(NameHeight + actorInfo.CurMountInfo.NameHightDiff); } else { Debug.LogError("创建坐骑成功,但找不到文字组件,可能导致文字高度错误!"); } } x.OnMountStateUpate(actorInfo.CurMountInfo == null ? false : actorInfo.CurMountInfo.IsRiding, moveFSM == null ? false : moveFSM.isMoving, IsShowing); if (!isDead) { animFSM.OnMount(actorInfo.CurMountInfo.IsRiding); SetInCombat(!actorInfo.CurMountInfo.IsRiding && GameCenter.curGameStage as CityStage == null); } } else { Debug.LogError("坐骑模型创建失败!"); } }); }