private void LookAtMainPlayerOnInteraction() { //npc 转向对着人物 if (m_NpcTmpVO.DialogueTurn == 1) { GameplayProxy gamePlayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy; HumanEntity mainPlayer = gamePlayProxy.GetEntityById <HumanEntity>(gamePlayProxy.GetMainPlayerUID()); Transform mptf = (mainPlayer != null) ? mainPlayer.GetSkinTransform() : null; if (mptf) { GetSkinTransform().DOLookAt(new Vector3(mptf.position.x, GetSkinTransform().position.y, mptf.position.z), 0.5f).SetAutoKill(true); } } }
/// <summary> /// 获取主玩家皮肤节点 /// </summary> /// <returns></returns> public Transform GetMainPlayerSkinTransform() { CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; if (!cfgEternityProxy.IsSpace()) { HumanEntity humanEntity = GetEntityById <HumanEntity>(GetMainPlayerUID()); if (humanEntity != null) { return(humanEntity.GetSkinTransform()); } } else { SpacecraftEntity spacecraftEntity = GetEntityById <SpacecraftEntity>(GetMainPlayerUID()); if (spacecraftEntity != null) { return(spacecraftEntity.GetSkinTransform()); } } return(null); }