/// <summary> /// 加载模型 /// </summary> /// <param name="target"></param> private void LoadViewerModel(SpacecraftEntity target) { if (m_NearestTarget != target) { m_NearestTarget = target; if (m_NearestTarget) { m_TargetList.Clear(); if (m_NearestTarget.m_EntityFatherOwnerID == 0 && m_NearestTarget.HeroGroupId == 0) { m_TargetViewer.LoadModel(ASSET_UI3DShip, FindSingleMine(), ASSET_UI3DEffect); } else { m_TargetViewer.LoadModel(ASSET_UI3DShip, FindSubsidiaryMine(), ASSET_UI3DEffect); } if (!m_NearestTargetLast) { PlaySound(WwiseMusicSpecialType.SpecialType_Voice_minera_event1); } } else { m_TargetViewer.ClearModel(); } if (m_NearestTargetLast && m_NearestTargetLast.GetAttribute(AttributeName.kHP) <= 0) { PlaySound(WwiseMusicSpecialType.SpecialType_Voice_minera_event2); } m_NearestTargetLast = m_NearestTarget; } }
/// <summary> /// 显示角色模型 /// </summary> public void ShowCharacter() { int tid = m_ServerListProxy.GetCurrentCharacterVO().Tid; if (m_CfgEternityProxy.GetPlayerByItemTId(tid) != null) { Model m_Model = m_CfgEternityProxy.GetItemModelByKey((uint)tid); Effect3DViewer m_npc3DViewer = m_CharacterModel.GetOrAddComponent <Effect3DViewer>(); if (m_npc3DViewer != null) { m_npc3DViewer.ClearModel(); m_npc3DViewer.LoadModel (AssetAddressKey.PRELOADUI_UI3D_ESCCHARACTERPANEL, m_Model.AssetName, AssetAddressKey.FX_UI_CHARACTER_SCANNING, GetNpcPos(m_Model), GetNpcRotation(m_Model), GetNpcScale(m_Model)); } } else { Debug.Log("tid错误" + tid); } }
/// <summary> /// 模型信息改变时 /// </summary> private void OnModelInfoChanged() { string environtment; Effect3DViewer.ModelInfo[] models; string effect; OwnerView.State.Get3DModelInfo(out environtment, out models, out effect); if (m_3DViewer) { m_3DViewer.LoadModel(environtment, models, effect); } }
/// <summary> /// 显示模型 /// </summary> public void ShowModel() { CfgEternityProxy m_CfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; Effect3DViewer m_Model3DViewer = m_Model.GetOrAddComponent <Effect3DViewer>(); UiModel m_UiModel = m_CfgEternityProxy.GetUiModel("Esc_1002"); if (m_Model3DViewer != null) { //m_Model3DViewer.AutoAdjustBestRotationAndDistance = true; m_Model3DViewer.ClearModel(); m_Model3DViewer.LoadModel (m_UiModel.Light, m_UiModel.ModelName, m_CfgEternityProxy.GetUiModelPos(m_UiModel), m_CfgEternityProxy.GetUiModelRotation(m_UiModel), m_CfgEternityProxy.GetUiModelScale(m_UiModel)); } }
/// <summary> /// 显示模型 /// </summary> public void ShowModel() { CfgEternityProxy m_CfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; ShipProxy m_ShipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy; IShip m_Ship = m_ShipProxy.GetAppointWarShip(); Effect3DViewer m_Model3DViewer = m_Model.GetOrAddComponent <Effect3DViewer>(); Model m_UiModel = m_CfgEternityProxy.GetModel((int)m_Ship.GetBaseConfig().Model); if (m_Model3DViewer != null) { m_Model3DViewer.AutoAdjustBestRotationAndDistance = true; m_Model3DViewer.ClearModel(); m_Model3DViewer.LoadModel (AssetAddressKey.PRELOADUI_UI3DSHIP, m_UiModel.AssetName); } }
/// <summary> /// 更新模型 /// </summary> private void UpdateModelViewer() { if (!m_ShipViewer) { return; } if (m_HasData) { Vector3 modelPosition = Vector3.zero; modelPosition.x = m_Model.UiPositionLength > 0 ? m_Model.UiPosition(0) : 0; modelPosition.y = m_Model.UiPositionLength > 1 ? m_Model.UiPosition(1) : 0; modelPosition.z = m_Model.UiPositionLength > 2 ? m_Model.UiPosition(2) : 0; Vector3 modelRotation = Vector3.zero; modelRotation.x = m_Model.UiRotationLength > 0 ? m_Model.UiRotation(0) : 0; modelRotation.y = m_Model.UiRotationLength > 1 ? m_Model.UiRotation(1) : 0; modelRotation.z = m_Model.UiRotationLength > 2 ? m_Model.UiRotation(2) : 0; float modelScale = m_Model.UiScale == 0 ? 1 : m_Model.UiScale; string effectPath = m_IsShip ? ASSET_UI3DSHIPEFFECT : ASSET_UI3DWEAPONEFFECT; m_ShipViewer.ModelRotate = !m_IsShip; m_ShipViewer.LoadModel(ASSET_UI3DSHIP, m_Model.AssetName, effectPath, modelPosition, modelRotation, modelScale * Vector3.one); m_ShipTransform.localPosition = m_Position; m_ShipTransform.sizeDelta = m_Size; } else { if (m_ShipViewer) { m_ShipViewer.ClearModel(); } } }