1080 lines
46 KiB
C#
1080 lines
46 KiB
C#
using CG.UTility;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using DG.Tweening;
|
||
using UnityEngine.Playables;
|
||
using CG.Framework;
|
||
using System;
|
||
using UnityEngine.UI;
|
||
using KinematicCharacterController;
|
||
using KinematicCharacterController.Examples;
|
||
/*******************************************************************************
|
||
*Create By CG
|
||
*Function
|
||
*******************************************************************************/
|
||
namespace ZXK.LouDiXvMuNiu
|
||
{
|
||
public class NiuSceneMng : MonoBehaviour
|
||
{
|
||
public static NiuSceneMng _Instance = null;
|
||
//物品展示
|
||
[SerializeField]
|
||
private Transform[] _toolContain = null;
|
||
[SerializeField]//所有作为标签出现在场景中的物体
|
||
private GameObject[] _signTrans = null;
|
||
private List<Transform> _curModuleToolArray = new List<Transform>();//当前步骤需要用到的所有工具
|
||
|
||
//动画交互
|
||
public NiuData _CurSceneStep;//为了方便做对比,临时保存当前步骤
|
||
|
||
private Dictionary<bool, List<GameObject>> _curStepUseBTDic;//当前步骤要点击的所有物体,true表示两个物体都要点,false表示点击其中一个即可
|
||
public Dictionary<bool, List<GameObject>> _CurStepUseBtDic { get => _curStepUseBTDic; }
|
||
private List<OutLineRender> _currentHighlights = new List<OutLineRender>();
|
||
private PlayableDirector _curTimeLine = null;
|
||
private TimelineDirectorCtrl _curTimeLineCtrl = null;
|
||
[SerializeField]
|
||
private PlayableAsset _peoplePlanTimeLineClip = null;
|
||
[SerializeField]
|
||
private PlayableAsset _CSPLCLTimeLineClip = null;
|
||
[SerializeField]
|
||
private PlayableAsset _TQFQCLTimeLineClip = null;
|
||
[SerializeField]
|
||
private PlayableAsset _JZLVJCTimeLineClip = null;
|
||
[SerializeField]
|
||
private PlayableAsset _RGSJTimeLineClip = null;
|
||
[SerializeField]
|
||
private PlayableAsset _CPTimeLineClip = null;
|
||
[SerializeField]
|
||
private PlayableAsset _PTXZTimeLineClip = null;
|
||
[SerializeField]
|
||
private PlayableAsset _PTYZTimeLineClip = null;
|
||
[SerializeField]
|
||
private PlayableAsset _YYZDTimeLineClip = null;
|
||
|
||
[SerializeField]
|
||
private Transform _TQFQTran = null;
|
||
[SerializeField]
|
||
private Transform _CSPLTran = null;
|
||
[SerializeField]
|
||
private Transform _RGSJTran = null;
|
||
[SerializeField]
|
||
private Transform _CPTran = null;
|
||
[SerializeField]
|
||
private Transform _YYZDTran = null;
|
||
|
||
|
||
private KinematicCharacterMotor kinematic = null;
|
||
private ExampleCharacterCamera characterCamera = null;
|
||
public bool _isNearCameraTR = false;
|
||
|
||
[ReadOnly]//是否正在播放动画
|
||
public bool _IsPlayAnm = false;
|
||
|
||
private void Awake()
|
||
{
|
||
if (_Instance == null)
|
||
{
|
||
_Instance = this;
|
||
}
|
||
_curTimeLine = GetComponent<PlayableDirector>();
|
||
_curTimeLineCtrl = GetComponent<TimelineDirectorCtrl>();
|
||
|
||
kinematic = Camera.main.GetComponent<CameraControl>()._CameraCtrl.transform.GetComponent<KinematicCharacterMotor>();
|
||
characterCamera = Camera.main.GetComponent<ExampleCharacterCamera>();
|
||
|
||
GameManager.Instance._EventManager.AddListener<ClickToolArgs>(OnClickToolEvent);
|
||
}
|
||
private void Start()
|
||
{
|
||
GetCurModuleTools();
|
||
InitFirstState();
|
||
StartCoroutine("InitScene");
|
||
}
|
||
private IEnumerator InitScene()
|
||
{
|
||
yield return new WaitForSeconds(0.1f);
|
||
List<NiuData> tempData = GameManager.Instance._DataNiuHandler.NiuStepTypeDic[GameManager.Instance._CurModelType];
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
|
||
{
|
||
for (int i = 0; i < tempData.Count; i++)
|
||
{
|
||
if (tempData[i].TaskType == ConstCtrl.TASKTYPE_ShowGeo)
|
||
{
|
||
_CurSceneStep = tempData[i];
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
_CurSceneStep = tempData[0];
|
||
}
|
||
|
||
GameManager.Instance._DataNiuHandler.CurNiuHandler.Value = _CurSceneStep;
|
||
|
||
if (GameManager.Instance._loopPopExplain)
|
||
{
|
||
GameObject explainContainGeo = UI_Manage.Instance.ShowPanel("ExplainContainPanel", System.Type.GetType("ZXK.LouDiXvMuNiu.ExplainContainPanel"), UIGroup.Tip);
|
||
explainContainGeo.GetComponent<ExplainContainPanel>()._IsFirstEnter = true;
|
||
}
|
||
}
|
||
private void Update()
|
||
{
|
||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||
RaycastHit rayHit;
|
||
NiuData curdata = GameManager.Instance._DataNiuHandler.CurNiuHandler.Value;
|
||
if (PopUpMng._TriAble && _CurSceneStep != null && !string.IsNullOrEmpty(curdata.TaskType))
|
||
{
|
||
UI_Manage.Instance.HidePanel("TooltipBoxTip");
|
||
if (Physics.Raycast(ray, out rayHit, Mathf.Infinity))
|
||
{
|
||
RecognizeNewGeo(rayHit, "牛的精液", rayHit.transform.name);
|
||
RecognizeNewGeo(rayHit, "OpenZhuShe", "注射器");
|
||
|
||
if (_curModuleToolArray.Contains(rayHit.transform))
|
||
{
|
||
Vector3 worldPos = rayHit.point;
|
||
if (rayHit.transform.name == "baodingjiaJH")
|
||
{//如果是牛的保定架,只有在物品展示的环节显示标签,其他环节不显示
|
||
if (curdata.TaskType.Equals(ConstCtrl.TASKTYPE_ShowGeo))
|
||
{
|
||
PopUpMng.ShowToolInfoTip(rayHit.transform.name, worldPos + Vector3.up * 0.05f, -1);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
PopUpMng.ShowToolInfoTip(rayHit.transform.name, worldPos + Vector3.up * 0.05f, -1);
|
||
}
|
||
}
|
||
}
|
||
|
||
if (_CurSceneStep.TaskType.Equals(ConstCtrl.TASKTYPE_Anim))
|
||
{//timeline动画
|
||
if (Input.GetMouseButtonDown(0) && Physics.Raycast(ray, out rayHit, Mathf.Infinity) && !_IsPlayAnm)
|
||
{
|
||
if (!string.IsNullOrEmpty(curdata.CameraNearTR2) && _isNearCameraTR)
|
||
{
|
||
CameraSetNear2TR(curdata);
|
||
}
|
||
ClickToolCallInTrainState(rayHit.transform.gameObject, () =>
|
||
{
|
||
JumpTimeline(GameManager.Instance._DataNiuHandler.GetNextStep(), false);
|
||
});
|
||
ClickToolCallInExamState(rayHit.transform.gameObject, () =>
|
||
{
|
||
JumpTimeline(GameManager.Instance._DataNiuHandler.GetNextStep(_CurSceneStep.QNextNum), false);
|
||
});
|
||
}
|
||
}
|
||
else if (_CurSceneStep.TaskType.Equals(ConstCtrl.TASKTYPE_Video))
|
||
{
|
||
if (Input.GetMouseButtonDown(0) && Physics.Raycast(ray, out rayHit, Mathf.Infinity))
|
||
{
|
||
ClickToolCallInTrainState(rayHit.transform.gameObject, () =>
|
||
{
|
||
GameObject videoGeo = UI_Manage.Instance.ShowPanel("VideoShowPanel", Type.GetType("ZXK.LouDiXvMuNiu.VideoShowPanel"), UIGroup.Tip);
|
||
videoGeo.GetComponent<VideoShowPanel>().PlayVideoClip(_CurSceneStep.VideoPath, () =>
|
||
{
|
||
GameManager.Instance._DataNiuHandler.CurNiuHandler.Value = GameManager.Instance._DataNiuHandler.GetNextStep();
|
||
});
|
||
});
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
private void OnDestroy()
|
||
{
|
||
_curTimeLineCtrl?.Stop();
|
||
GameManager.Instance._EventManager.RemoveListener<ClickToolArgs>(OnClickToolEvent);
|
||
}
|
||
|
||
private void OnClickToolEvent(ClickToolArgs e)
|
||
{
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
|
||
{
|
||
|
||
if (e.SelectTool == "牛的精液")
|
||
{
|
||
string[] temp = new string[] { "牛的精液A", "牛的精液B", "牛的精液C" };
|
||
for (int a = 0; a < temp.Length; a++)
|
||
{
|
||
GameObject toolTempGeo = UtilitiesMng.GetGeoByName(_toolContain, temp[a], true);
|
||
toolTempGeo.SetActive(true);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
GameObject toolGeo = UtilitiesMng.GetGeoByName(_toolContain, e.SelectTool, true);
|
||
toolGeo?.SetActive(true);
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 播放动画前场景物体状态
|
||
/// </summary>
|
||
private void InitFirstState()
|
||
{
|
||
foreach (Transform t in _TQFQTran)
|
||
{
|
||
t.gameObject.SetActive(false);
|
||
}
|
||
foreach (Transform t in _CSPLTran)
|
||
{
|
||
t.gameObject.SetActive(false);
|
||
}
|
||
foreach (Transform t in _RGSJTran)
|
||
{
|
||
t.gameObject.SetActive(false);
|
||
}
|
||
//默认工具全不显示
|
||
UseToolsActive(false);
|
||
}
|
||
public void InitPlayAnmState(NiuData curObj, NiuData previousObj)
|
||
{
|
||
if (curObj == null) return;
|
||
if (curObj.TaskName != previousObj.TaskName)
|
||
{
|
||
InitFirstState();
|
||
if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_TQFAQCL))
|
||
{
|
||
GameObject jiaziGeo = UtilitiesMng.GetGeoByName(_toolContain, "M_Jiazi_b", true);
|
||
jiaziGeo.transform.localPosition = new Vector3(-0.3f, 0.5998f, 2.47f);
|
||
jiaziGeo.transform.localRotation = Quaternion.Euler(Vector3.zero);
|
||
|
||
_TQFQTran.Find("SM_Niu_CaShi_an01").gameObject.SetActive(true);
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_CSPLCL))
|
||
{
|
||
GameObject jiaziGeo = UtilitiesMng.GetGeoByName(_toolContain, "M_Jiazi_b", true);
|
||
jiaziGeo.transform.localPosition = new Vector3(-0.3f, 0.5998f, 0.157f);
|
||
jiaziGeo.transform.localRotation = Quaternion.Euler(Vector3.zero);
|
||
|
||
_CSPLTran.Find("SM_Niu_ZhusheB_Bozi_an02renG").gameObject.SetActive(true);
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_JZLVJC))
|
||
{
|
||
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_RGSJ))
|
||
{
|
||
GameObject jiaziGeo = UtilitiesMng.GetGeoByName(_toolContain, "M_Jiazi_b", true);
|
||
jiaziGeo.transform.localPosition = new Vector3(-0.485f, 0.5997721f, 2.109f);
|
||
jiaziGeo.transform.localRotation = Quaternion.Euler(Vector3.zero);
|
||
GameObject gjj2Geo = UtilitiesMng.GetGeoByName(_toolContain, "工具架2", true);
|
||
gjj2Geo.gameObject.SetActive(true);
|
||
_RGSJTran.Find("SM_Niu_RenGongSouJing01").gameObject.SetActive(true);
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_CP))
|
||
{
|
||
GameObject jiaziGeo = UtilitiesMng.GetGeoByName(_toolContain, "M_Jiazi_b", true);
|
||
jiaziGeo.transform.localPosition = new Vector3(-0.81f, 0.632f, 2.883f);
|
||
jiaziGeo.transform.localRotation = Quaternion.Euler(Vector3.up * -180.0f);
|
||
|
||
Transform toolTemp = jiaziGeo.transform.Find("冲卵管");
|
||
foreach (Transform item in toolTemp)
|
||
{
|
||
item.gameObject.SetActive(true);
|
||
}
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("TrainState"))
|
||
{//如果训练模式下,物品展示时显示物品
|
||
if (curObj.ThreeTaskName == ConstCtrl.ThreeTaskName_PrepareGeo)
|
||
{
|
||
foreach (Transform item in toolTemp)
|
||
{
|
||
item.gameObject.SetActive(false);
|
||
}
|
||
}
|
||
}
|
||
|
||
_CPTran.Find("SM_Niu_ChongPei01").gameObject.SetActive(true);
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_PTXZ))
|
||
{
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_PTYZ))
|
||
{
|
||
GameObject jiaziGeo = UtilitiesMng.GetGeoByName(_toolContain, "M_Jiazi_b", true);
|
||
jiaziGeo.transform.localPosition = new Vector3(-0.485f, 0.5997721f, 2.109f);
|
||
jiaziGeo.transform.localRotation = Quaternion.Euler(Vector3.zero);
|
||
_RGSJTran.Find("SM_Niu_RenGongSouJing01").gameObject.SetActive(true);
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_YYZD))
|
||
{
|
||
GameObject jiaziGeo = UtilitiesMng.GetGeoByName(_toolContain, "M_Jiazi_b", true);
|
||
jiaziGeo.transform.localPosition = new Vector3(-0.81f, 0.632f, 2.883f);
|
||
jiaziGeo.transform.localRotation = Quaternion.Euler(Vector3.up * -180.0f);
|
||
|
||
_YYZDTran.Find("SM_YinDaoJianCha01").gameObject.SetActive(true);
|
||
}
|
||
}
|
||
if (curObj.ThreeTaskName != previousObj.ThreeTaskName)
|
||
{
|
||
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("TrainState"))
|
||
{//如果训练模式下,物品展示时显示物品
|
||
if (curObj.ThreeTaskName == ConstCtrl.ThreeTaskName_PrepareGeo)
|
||
{
|
||
NiuSceneMng._Instance.UseToolsActive(true);
|
||
}
|
||
}
|
||
|
||
//需要点击的物体在人员准备的时候重新全部显示
|
||
if (curObj.ThreeTaskName == ConstCtrl.ThreeTaskName_PeoplePlan)
|
||
{
|
||
List<NiuData> curSteps = GameManager.Instance._DataNiuHandler.NiuStepTypeDic[GameManager.Instance._CurModelType];
|
||
for (int i = 0; i < curSteps.Count; i++)
|
||
{
|
||
if (curSteps[i].ThreeTaskName == ConstCtrl.ThreeTaskName_PeoplePlan)
|
||
{
|
||
string toolStr = curSteps[i].ModelBT;
|
||
GameObject toolGeo = UtilitiesMng.GetGeoByName(new Transform[1] { transform }, toolStr, true);
|
||
toolGeo.SetActive(true);
|
||
}
|
||
}
|
||
}
|
||
|
||
if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_TQFAQCL))
|
||
{
|
||
SetTimeLineCtrl(curObj, previousObj, _TQFQCLTimeLineClip, 0);
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_CSPLCL))
|
||
{
|
||
SetTimeLineCtrl(curObj, previousObj, _CSPLCLTimeLineClip, 0);
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_JZLVJC))
|
||
{
|
||
SetTimeLineCtrl(curObj, previousObj, _JZLVJCTimeLineClip, 0);
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_RGSJ))
|
||
{
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("TrainState"))
|
||
{//如果训练模式下,物品展示时显示物品
|
||
if (curObj.ThreeTaskName == ConstCtrl.ThreeTaskName_PrepareGeo)
|
||
{
|
||
GameObject geoTemp = UtilitiesMng.GetGeoByName(_toolContain, "baodingjiaJH", true);
|
||
geoTemp.SetActive(true);
|
||
}
|
||
SetTimeLineCtrl(curObj, previousObj, _RGSJTimeLineClip, 0);
|
||
}
|
||
else
|
||
{
|
||
SetTimeLineCtrl(curObj, previousObj, _RGSJTimeLineClip, 5 / 60.0f);
|
||
}
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_CP))
|
||
{
|
||
GameObject jiaziGeo = UtilitiesMng.GetGeoByName(_toolContain, "M_Jiazi_b", true);
|
||
Transform toolTemp = jiaziGeo.transform.Find("冲卵管");
|
||
foreach (Transform item in toolTemp)
|
||
{
|
||
item.gameObject.SetActive(true);
|
||
}
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("TrainState"))
|
||
{//如果训练模式下,物品展示时显示物品
|
||
SetTimeLineCtrl(curObj, previousObj, _CPTimeLineClip, 0);
|
||
if (curObj.ThreeTaskName == ConstCtrl.ThreeTaskName_PrepareGeo)
|
||
{
|
||
foreach (Transform item in toolTemp)
|
||
{
|
||
item.gameObject.SetActive(false);
|
||
}
|
||
GameObject geoTemp = UtilitiesMng.GetGeoByName(_toolContain, "baodingjiaJH", true);
|
||
geoTemp.SetActive(true);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
SetTimeLineCtrl(curObj, previousObj, _CPTimeLineClip, 5 / 60.0f);
|
||
}
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_PTXZ))
|
||
{
|
||
SetTimeLineCtrl(curObj, previousObj, _PTXZTimeLineClip, 0);
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_PTYZ))
|
||
{
|
||
SetTimeLineCtrl(curObj, previousObj, _PTYZTimeLineClip, 0);
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("TrainState"))
|
||
{//如果训练模式下,物品展示时显示物品
|
||
if (curObj.ThreeTaskName == ConstCtrl.ThreeTaskName_PrepareGeo)
|
||
{
|
||
GameObject bhyGeoTemp = UtilitiesMng.GetGeoByName(_toolContain, "保护液", true);
|
||
bhyGeoTemp.transform.localPosition = new Vector3(-0.0822f, 0.396500051f, 0.00615262985f);
|
||
bhyGeoTemp.transform.localRotation = new Quaternion(0,0.707106829f,0.707106829f,0);
|
||
GameObject ptygeoTemp = UtilitiesMng.GetGeoByName(_toolContain, "胚胎液", true);
|
||
ptygeoTemp.transform.localPosition = new Vector3(-0.0820000023f, 0.396499991f, -0.0887999982f);
|
||
ptygeoTemp.transform.localRotation = new Quaternion(0, 0.707106829f, 0.707106829f, 0);
|
||
GameObject ksqgeoTemp = UtilitiesMng.GetGeoByName(_toolContain, "凯苏枪", true);
|
||
ksqgeoTemp.transform.localPosition = new Vector3(0.25999999f, 0.409000009f, 0.381999999f);
|
||
ksqgeoTemp.transform.localRotation = new Quaternion(-0.00385814067f, 0.707096279f, 0.00385814067f, 0.707096279f);
|
||
GameObject blxggeoTemp = UtilitiesMng.GetGeoByName(_toolContain, "玻璃细管", true);
|
||
blxggeoTemp.transform.localPosition = new Vector3(0.221799999f, 0.400900006f, -0.0782999992f);
|
||
blxggeoTemp.transform.localRotation = new Quaternion(0.5f, 0.5f, 0.5f, 0.5f);
|
||
}
|
||
}
|
||
}
|
||
else if (GameManager.Instance._CurModelType.Equals(ConstCtrl.ModuleName_YYZD))
|
||
{
|
||
GameObject jiaziGeo = UtilitiesMng.GetGeoByName(_toolContain, "M_Jiazi_b", true);
|
||
Transform toolTemp = jiaziGeo.transform.Find("开窒器");
|
||
foreach (Transform item in toolTemp)
|
||
{
|
||
item.gameObject.SetActive(true);
|
||
}
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("TrainState"))
|
||
{//如果训练模式下,物品展示时显示物品
|
||
if (curObj.ThreeTaskName == ConstCtrl.ThreeTaskName_PrepareGeo)
|
||
{
|
||
foreach (Transform item in toolTemp)
|
||
{
|
||
item.gameObject.SetActive(false);
|
||
}
|
||
}
|
||
}
|
||
SetTimeLineCtrl(curObj, previousObj, _YYZDTimeLineClip, 0);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 根据不同任务名称切换动画控制器
|
||
/// </summary>
|
||
private void SetTimeLineCtrl(NiuData curObj, NiuData previousObj, PlayableAsset timeAsset,double pauseTime)
|
||
{
|
||
if (curObj!=null&& previousObj!=null)
|
||
{
|
||
if (curObj.TaskName.Equals(ConstCtrl.TaskName_ActualOperation))
|
||
{
|
||
if (_curTimeLine.playableAsset != timeAsset)
|
||
{
|
||
_curTimeLine.playableAsset = timeAsset;
|
||
_curTimeLineCtrl.SetDuration();
|
||
_curTimeLineCtrl.StopInTime(pauseTime);
|
||
}
|
||
}
|
||
else if (curObj.TaskName.Equals(ConstCtrl.TaskName_OperationPlan))
|
||
{
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
|
||
{
|
||
if (_curTimeLine.playableAsset != _peoplePlanTimeLineClip)
|
||
{
|
||
_curTimeLine.playableAsset = _peoplePlanTimeLineClip;
|
||
_curTimeLineCtrl.SetDuration();
|
||
_curTimeLineCtrl.Stop();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (curObj.ThreeTaskName == ConstCtrl.ThreeTaskName_PrepareGeo)
|
||
{
|
||
if (_curTimeLine.playableAsset != timeAsset)
|
||
{
|
||
_curTimeLine.playableAsset = timeAsset;
|
||
_curTimeLineCtrl.SetDuration();
|
||
_curTimeLineCtrl.StopInTime(pauseTime);
|
||
}
|
||
}
|
||
if (curObj.ThreeTaskName == ConstCtrl.ThreeTaskName_PeoplePlan)
|
||
{
|
||
if (_curTimeLine.playableAsset != _peoplePlanTimeLineClip)
|
||
{
|
||
_curTimeLine.playableAsset = _peoplePlanTimeLineClip;
|
||
_curTimeLineCtrl.SetDuration();
|
||
_curTimeLineCtrl.Stop();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取当前模块需要用到的工具
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private void GetCurModuleTools()
|
||
{
|
||
List<string> toolArray = new List<string>();
|
||
List<NiuData> tempData = GameManager.Instance._DataNiuHandler.NiuStepTypeDic[GameManager.Instance._CurModelType];
|
||
for (int i = 0; i < tempData.Count; i++)
|
||
{
|
||
if (string.IsNullOrEmpty(tempData[i].ToolsName)) continue;
|
||
string[] tools = tempData[i].ToolsName.Split("|");
|
||
for (int j = 0; j < tools.Length; j++)
|
||
{
|
||
GameObject toolGeo = UtilitiesMng.GetGeoByName(_toolContain, tools[j], true);
|
||
if (toolGeo&&!toolArray.Contains(tools[j]))
|
||
{
|
||
toolArray.Add(tools[j]);
|
||
_curModuleToolArray.Add(toolGeo.transform);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 该模块用到的所有工具显示状态
|
||
/// </summary>
|
||
/// <param name="showAble"></param>
|
||
public void UseToolsActive(bool showAble)
|
||
{
|
||
for (int i = 0; i < _curModuleToolArray.Count; i++)
|
||
{
|
||
_curModuleToolArray[i].gameObject.SetActive(showAble);
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取此步骤需要点击的工具
|
||
/// </summary>
|
||
/// <param name="step"></param>
|
||
public void GetNeedClickTools(NiuData step)
|
||
{
|
||
_curStepUseBTDic = new Dictionary<bool, List<GameObject>>();
|
||
List<GameObject> toolTemp = new List<GameObject>();
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("TrainState"))
|
||
{
|
||
string[] tempBts = step.ModelBT.Split("|");
|
||
string[] tempSelects = tempBts[0].Split("+");
|
||
for (int i = 0; i < tempSelects.Length; i++)
|
||
{
|
||
GameObject tempGeo = UtilitiesMng.GetGeoByName(new Transform[1] { transform }, tempSelects[i], step.ThreeTaskName != ConstCtrl.ThreeTaskName_PeoplePlan);
|
||
if (tempGeo == null) continue;
|
||
tempGeo.SetActive(true);
|
||
toolTemp.Add(tempGeo);
|
||
}
|
||
_curStepUseBTDic.Add(true, toolTemp);
|
||
}
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
|
||
{
|
||
string[] tempBts = step.ModelBT.Split("|");
|
||
if (!string.IsNullOrEmpty(step.ExamModelBT))
|
||
{
|
||
tempBts = step.ExamModelBT.Split("|");
|
||
}
|
||
for (int i = 0; i < tempBts.Length; i++)
|
||
{
|
||
string[] tempExamSelects = null;
|
||
if (tempBts[i].Contains("+"))
|
||
{
|
||
tempExamSelects = tempBts[i].Split("+");
|
||
}
|
||
else if (tempBts[i].Contains("*"))
|
||
{
|
||
tempExamSelects = tempBts[i].Split("*");
|
||
}
|
||
else
|
||
{
|
||
tempExamSelects = new string[1] { tempBts[i] };
|
||
}
|
||
for (int j = 0; j < tempExamSelects.Length; j++)
|
||
{
|
||
GameObject tempGeo = UtilitiesMng.GetGeoByName(new Transform[1] { transform }, tempExamSelects[j], true);
|
||
if (tempGeo == null) continue;
|
||
tempGeo.SetActive(true);
|
||
if (i == 0)
|
||
{
|
||
toolTemp.Add(tempGeo);
|
||
}
|
||
}
|
||
if (tempBts[i].Contains("*"))
|
||
{
|
||
_curStepUseBTDic.Add(false, toolTemp);
|
||
}
|
||
else
|
||
{
|
||
_curStepUseBTDic.Add(true, toolTemp);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 让此步骤需要点击的物体高亮显示
|
||
/// </summary>
|
||
/// <param name="model">需要点击物体名字</param>
|
||
public void OnlyShowBTGeo(GameObject[] modelBTsName)
|
||
{
|
||
for (int i = 0; i < _currentHighlights.Count; i++)
|
||
{
|
||
_currentHighlights[i].enabled = false;
|
||
}
|
||
for (int i = 0; i < modelBTsName.Length; i++)
|
||
{
|
||
string modelBTName = modelBTsName[i].name;
|
||
if (!modelBTName.Contains("_sign"))
|
||
{
|
||
OutLineRender outlineRender;
|
||
// 如果模型上没有泛光效果组件,则添加一个新的
|
||
if (!modelBTsName[i].TryGetComponent(out outlineRender))
|
||
{
|
||
outlineRender = modelBTsName[i].AddComponent<OutLineRender>();
|
||
}
|
||
// 设置泛光强度和默认禁用泛光效果
|
||
outlineRender.OutLineStrength = 1;
|
||
outlineRender.enabled = true;
|
||
// 将泛光效果组件添加到高亮列表中
|
||
_currentHighlights.Add(outlineRender);
|
||
}
|
||
}
|
||
|
||
}
|
||
/// <summary>
|
||
/// 训练模式下点击物体触发下一步
|
||
/// </summary>
|
||
/// <param name="triGeo"></param>
|
||
/// <param name="clickFinishCall"></param>
|
||
private void ClickToolCallInTrainState(GameObject triGeo,Action clickFinishCall)
|
||
{
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState")) return;
|
||
if (_curStepUseBTDic.ContainsKey(true))
|
||
{
|
||
List<GameObject> useBts = _curStepUseBTDic[true];
|
||
if (useBts.Contains(triGeo))
|
||
{
|
||
if (triGeo.GetComponent<OutLineRender>())
|
||
{
|
||
triGeo.GetComponent<OutLineRender>().enabled = false;
|
||
}
|
||
|
||
if (triGeo.tag != ConstCtrl.SceneTool_Tag)
|
||
{
|
||
triGeo.SetActive(false);
|
||
}
|
||
useBts.Remove(triGeo);
|
||
}
|
||
|
||
if (useBts.Count == 0)
|
||
{
|
||
foreach (var item in _curStepUseBTDic)
|
||
{
|
||
for (int i = 0; i < item.Value.Count; i++)
|
||
{
|
||
if (item.Value[i].tag != ConstCtrl.SceneTool_Tag)
|
||
{
|
||
item.Value[i].SetActive(false);
|
||
}
|
||
}
|
||
}
|
||
_curStepUseBTDic.Clear();
|
||
|
||
clickFinishCall?.Invoke();
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 考核模式下点击物体触发下一步
|
||
/// </summary>
|
||
/// <param name="triGeo"></param>
|
||
/// <param name="clickFinishCall"></param>
|
||
private void ClickToolCallInExamState(GameObject triGeo, Action clickFinishCall)
|
||
{
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
|
||
{
|
||
bool addScoreTemp = true;
|
||
List<GameObject> useBts = new List<GameObject>();
|
||
if (_curStepUseBTDic.ContainsKey(false))
|
||
{
|
||
useBts = _curStepUseBTDic[false];
|
||
if (useBts.Contains(triGeo))
|
||
{
|
||
useBts.Clear();
|
||
}
|
||
}
|
||
else if(_curStepUseBTDic.ContainsKey(true))
|
||
{
|
||
useBts = _curStepUseBTDic[true];
|
||
if (useBts.Contains(triGeo))
|
||
{
|
||
if (triGeo.GetComponent<OutLineRender>())
|
||
{
|
||
triGeo.GetComponent<OutLineRender>().enabled = false;
|
||
}
|
||
if (triGeo.tag != ConstCtrl.SceneTool_Tag)
|
||
{
|
||
triGeo.SetActive(false);
|
||
}
|
||
useBts.Remove(triGeo);
|
||
}
|
||
else
|
||
{
|
||
PopUpMng.PopChoseErrowToast(_CurSceneStep.ExamEvvr, 2.0f);
|
||
useBts.Clear();
|
||
addScoreTemp = false;
|
||
}
|
||
}
|
||
|
||
if (useBts.Count == 0)
|
||
{
|
||
foreach (var item in _curStepUseBTDic)
|
||
{
|
||
for (int i = 0; i < item.Value.Count; i++)
|
||
{
|
||
if (item.Value[i].tag != ConstCtrl.SceneTool_Tag)
|
||
{
|
||
item.Value[i].SetActive(false);
|
||
}
|
||
}
|
||
}
|
||
|
||
for (int i = 0; i < _signTrans.Length; i++)
|
||
{
|
||
_signTrans[i].SetActive(false);
|
||
}
|
||
|
||
_curStepUseBTDic.Clear();
|
||
|
||
if (addScoreTemp)
|
||
{
|
||
GameManager.Instance._DataNiuHandler.AddScore(_CurSceneStep.ModuleName, _CurSceneStep.ThreeTaskName, _CurSceneStep.Score);
|
||
}
|
||
|
||
clickFinishCall?.Invoke();
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 步骤是答题系统类型的处理方式
|
||
/// </summary>
|
||
/// <param name="step"></param>
|
||
public void AnswerSystemInStep(NiuData step)
|
||
{
|
||
string[] answers = step.OptionsAll.Split("|");
|
||
PopUpMng.PopAnswerQuestions(step.Question, answers, GetOptionIndex(step.OptionRight), () =>
|
||
{
|
||
JumpTimeline(GameManager.Instance._DataNiuHandler.GetNextStep(_CurSceneStep.QNextNum), false);
|
||
});
|
||
}
|
||
/// <summary>
|
||
/// 步骤是过渡类型的处理方式
|
||
/// </summary>
|
||
/// <param name="step"></param>
|
||
public void TimeTranInStep(NiuData step)
|
||
{
|
||
_IsPlayAnm = true;
|
||
string[] msg = step.ModelBT.Split("|");
|
||
string timeFixMsg = msg[0];
|
||
string[] timepoints = msg[1].Split("-");
|
||
int startTime = int.Parse(timepoints[0]);
|
||
int endTime = int.Parse(timepoints[1]);
|
||
PopUpMng.PopTimeIntCount(timeFixMsg, startTime, endTime, 3.0f, endTime >= startTime, () =>
|
||
{
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("TrainState"))
|
||
{
|
||
JumpTimeline(GameManager.Instance._DataNiuHandler.GetNextStep(), false);
|
||
//GameManager.Instance._DataNiuHandler.CurNiuHandler.Value = GameManager.Instance._DataNiuHandler.GetNextStep();
|
||
}
|
||
else if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
|
||
{
|
||
JumpTimeline(GameManager.Instance._DataNiuHandler.GetNextStep(_CurSceneStep.QNextNum), false);
|
||
//GameManager.Instance._DataNiuHandler.CurNiuHandler.Value = GameManager.Instance._DataNiuHandler.GetNextStep(_CurSceneStep.QNextNum);
|
||
}
|
||
_IsPlayAnm = false;
|
||
});
|
||
}
|
||
/// <summary>
|
||
/// 步骤是过渡动画类型的处理方式
|
||
/// </summary>
|
||
/// <param name="step"></param>
|
||
public void TimeTranAnmInStep(NiuData step)
|
||
{
|
||
string[] msg = step.ModelBT.Split("|");
|
||
string timeFixMsg = msg[0];
|
||
string[] timepoints = msg[1].Split("-");
|
||
int startTime = int.Parse(timepoints[0]);
|
||
int endTime = int.Parse(timepoints[1]);
|
||
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("TrainState"))
|
||
{
|
||
JumpTimeline(GameManager.Instance._DataNiuHandler.GetNextStep(), false);
|
||
}
|
||
else if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
|
||
{
|
||
JumpTimeline(GameManager.Instance._DataNiuHandler.GetNextStep(_CurSceneStep.QNextNum), false);
|
||
}
|
||
|
||
float durTime = step.TimelineLength / 60.0f;
|
||
PopUpMng.PopTimeIntCount(timeFixMsg, startTime, endTime, durTime, endTime >= startTime, null);
|
||
}
|
||
/// <summary>
|
||
/// 图片选择类题型
|
||
/// 目前只有胚胎选择最后一步需要
|
||
/// </summary>
|
||
/// <param name="temp"></param>
|
||
public void ChoiceImgInStep(string[] temp)
|
||
{
|
||
if (GameManager.Instance._StateContext.GetState().Name.Equals("TrainState"))
|
||
{
|
||
GameObject tempGeo = UtilitiesMng.GetGeoByName(new Transform[1] { transform }, temp[0], true);
|
||
tempGeo.SetActive(true);
|
||
tempGeo.GetComponent<Toggle>().isOn = false;
|
||
tempGeo.GetComponent<Toggle>().onValueChanged.AddListener((isOn) =>
|
||
{
|
||
if (isOn)
|
||
{
|
||
//tempGeo.transform.GetChild(0).gameObject.SetActive(true);
|
||
//float a = 0.0f;
|
||
//DOTween.To(() => a, x => x = a, 1.0f, 2.0f).OnComplete(() =>
|
||
//{
|
||
// tempGeo.SetActive(false);
|
||
//});
|
||
JumpTimeline(GameManager.Instance._DataNiuHandler.GetNextStep(), false);
|
||
tempGeo.SetActive(false);
|
||
}
|
||
});
|
||
}
|
||
else if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
|
||
{
|
||
List<GameObject> togs = new List<GameObject>();
|
||
for (int i = 0; i < temp.Length; i++)
|
||
{
|
||
GameObject tempGeo = UtilitiesMng.GetGeoByName(new Transform[1] { transform }, temp[i], true);
|
||
tempGeo.transform.GetChild(0).gameObject.SetActive(false);
|
||
togs.Add(tempGeo);
|
||
tempGeo.SetActive(true);
|
||
tempGeo.GetComponent<Toggle>().isOn = false;
|
||
tempGeo.GetComponent<Toggle>().onValueChanged.AddListener((isOn) =>
|
||
{
|
||
if (isOn)
|
||
{
|
||
for (int i = 0; i < togs.Count; i++)
|
||
{
|
||
togs[i].transform.GetChild(0).gameObject.SetActive(true);
|
||
}
|
||
float a = 0.0f;
|
||
DOTween.To(() => a, x => x = a, 1.0f, 2.0f).OnComplete(() =>
|
||
{
|
||
for (int i = 0; i < togs.Count; i++)
|
||
{
|
||
togs[i].SetActive(false);
|
||
}
|
||
});
|
||
JumpTimeline(GameManager.Instance._DataNiuHandler.GetNextStep(), false);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 继续播放Timeline动画
|
||
/// </summary>
|
||
public void TimelineContinue()
|
||
{
|
||
_curTimeLineCtrl.Continue();
|
||
}
|
||
/// <summary>
|
||
/// 跳转动画步骤
|
||
/// </summary>
|
||
/// <param name="partData"></param>
|
||
public void JumpTimeline(NiuData partData,bool jumpStepAble)
|
||
{
|
||
if (_CurSceneStep == null) _CurSceneStep = partData;
|
||
if (_CurSceneStep.id == partData.id)
|
||
{//相同步骤不跳转
|
||
}
|
||
else
|
||
{//跳转不同步骤,可能是点击上下步产生的,每次点击上下步对应的跳转是上下步里面的第一个小步骤
|
||
_IsPlayAnm = true;
|
||
if (_CurSceneStep.id > partData.id)
|
||
{//逆序跳转,倒播
|
||
if (!jumpStepAble)
|
||
{
|
||
_curTimeLineCtrl.ContinuePlayBackwardByPausePoint(GetPlayTime(_CurSceneStep,partData, jumpStepAble), () =>
|
||
{
|
||
NegativeJumpStep(partData);
|
||
});
|
||
}
|
||
else
|
||
{
|
||
_curTimeLineCtrl.StopInTime(GetPlayTime(_CurSceneStep, partData, jumpStepAble));
|
||
NegativeJumpStep(partData);
|
||
}
|
||
}
|
||
else if (_CurSceneStep.id < partData.id)
|
||
{//顺序跳转,正播
|
||
if (!jumpStepAble)
|
||
{
|
||
_curTimeLineCtrl.ContinuePlayForwardByPausePoint(GetPlayTime(_CurSceneStep, partData, jumpStepAble), () =>
|
||
{
|
||
PositiveJumpStep(partData);
|
||
});
|
||
}
|
||
else
|
||
{
|
||
_curTimeLineCtrl.StopInTime(GetPlayTime(_CurSceneStep, partData, jumpStepAble));
|
||
PositiveJumpStep(partData);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
public void JumpToTime(float time)
|
||
{
|
||
_curTimeLineCtrl.ContinuePlayBackwardByPausePoint(time, null);
|
||
}
|
||
/// <summary>
|
||
/// 正向跳转步骤
|
||
/// </summary>
|
||
/// <param name="partData"></param>
|
||
private void PositiveJumpStep(NiuData partData)
|
||
{
|
||
_IsPlayAnm = false;
|
||
_CurSceneStep = partData;
|
||
GameManager.Instance._DataNiuHandler.CurNiuHandler.Value = partData;
|
||
}
|
||
/// <summary>
|
||
/// 反向跳转步骤
|
||
/// </summary>
|
||
/// <param name="partData"></param>
|
||
private void NegativeJumpStep(NiuData partData)
|
||
{
|
||
_IsPlayAnm = false;
|
||
_CurSceneStep = partData;
|
||
GameManager.Instance._DataNiuHandler.CurNiuHandler.Value = partData;
|
||
}
|
||
/// <summary>
|
||
/// 获取当前要播放的动画片段的开始时间
|
||
/// </summary>
|
||
/// <param name="step"></param>
|
||
/// <returns></returns>
|
||
private float GetPlayTime(NiuData perviousStep,NiuData step, bool jumpStepAble)
|
||
{
|
||
int allFrame = 0;
|
||
List<NiuData> modelInfos = GameManager.Instance._DataNiuHandler.NiuStepTypeDic[GameManager.Instance._CurModelType];
|
||
|
||
string addAbleTaskName = null;
|
||
if (jumpStepAble)
|
||
{
|
||
addAbleTaskName = step.TaskName;
|
||
}
|
||
else
|
||
{
|
||
if(perviousStep.TaskName!= step.TaskName)
|
||
{
|
||
addAbleTaskName = perviousStep.TaskName;
|
||
}
|
||
else
|
||
{
|
||
addAbleTaskName = step.TaskName;
|
||
}
|
||
}
|
||
for (int a = 0; a < modelInfos.Count; a++)
|
||
{
|
||
if (modelInfos[a].TaskName.Equals(addAbleTaskName) && modelInfos[a].id < step.id)
|
||
{
|
||
allFrame += modelInfos[a].TimelineLength;
|
||
}
|
||
}
|
||
return allFrame / 60.0f;
|
||
}
|
||
|
||
public int GetOptionIndex(string OptionMsg)
|
||
{
|
||
switch (OptionMsg)
|
||
{
|
||
case "A":
|
||
return 0;
|
||
case "B":
|
||
return 1;
|
||
case "C":
|
||
return 2;
|
||
case "D":
|
||
return 3;
|
||
default:
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置摄像机为近距离视角
|
||
/// </summary>
|
||
public void CameraSetNearTR(NiuData obj)
|
||
{
|
||
if (string.IsNullOrEmpty(obj.CameraNearTR)) return;
|
||
_isNearCameraTR = true;
|
||
try
|
||
{
|
||
string[] cameraDefaultTR = obj.CameraNearTR.Split("|");
|
||
string[] camDefPosStr = cameraDefaultTR[0].Split("_");
|
||
string[] camDefRotStr = cameraDefaultTR[1].Split("_");
|
||
Vector3 cameraDefPos = new Vector3(float.Parse(camDefPosStr[0]), float.Parse(camDefPosStr[1]), float.Parse(camDefPosStr[2]));
|
||
Vector3 cameraDefRot = new Vector3(float.Parse(camDefRotStr[0]), float.Parse(camDefRotStr[1]), float.Parse(camDefRotStr[2]));
|
||
|
||
ChangeCameraPos(cameraDefPos, cameraDefRot);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
WDebug.LogError($"数据出现错误:{ex.Message}");
|
||
return;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置摄像机为默认视角
|
||
/// </summary>
|
||
/// <param name="obj"></param>
|
||
public void CameraSetDefaultTR(NiuData obj)
|
||
{
|
||
if (string.IsNullOrEmpty(obj.CameraDefaultTR)) return;
|
||
_isNearCameraTR = false;
|
||
try
|
||
{
|
||
string[] cameraDefaultTR = obj.CameraDefaultTR.Split("|");
|
||
string[] camDefPosStr = cameraDefaultTR[0].Split("_");
|
||
string[] camDefRotStr = cameraDefaultTR[1].Split("_");
|
||
Vector3 cameraDefPos = new Vector3(float.Parse(camDefPosStr[0]), float.Parse(camDefPosStr[1]), float.Parse(camDefPosStr[2]));
|
||
Vector3 cameraDefRot = new Vector3(float.Parse(camDefRotStr[0]), float.Parse(camDefRotStr[1]), float.Parse(camDefRotStr[2]));
|
||
|
||
ChangeCameraPos(cameraDefPos, cameraDefRot);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
WDebug.LogError($"数据出现错误:{ex.Message}");
|
||
return;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置摄像机为近距离视角
|
||
/// </summary>
|
||
private void CameraSetNear2TR(NiuData obj)
|
||
{
|
||
if (string.IsNullOrEmpty(obj.CameraNearTR2)) return;
|
||
try
|
||
{
|
||
string[] cameraDefaultTR = obj.CameraNearTR2.Split("|");
|
||
string[] camDefPosStr = cameraDefaultTR[0].Split("_");
|
||
string[] camDefRotStr = cameraDefaultTR[1].Split("_");
|
||
Vector3 cameraDefPos = new Vector3(float.Parse(camDefPosStr[0]), float.Parse(camDefPosStr[1]), float.Parse(camDefPosStr[2]));
|
||
Vector3 cameraDefRot = new Vector3(float.Parse(camDefRotStr[0]), float.Parse(camDefRotStr[1]), float.Parse(camDefRotStr[2]));
|
||
|
||
ChangeCameraPos(cameraDefPos, cameraDefRot);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
WDebug.LogError($"数据出现错误:{ex.Message}");
|
||
return;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 调整场景摄像机位置
|
||
/// </summary>
|
||
/// <param name="pos"></param>
|
||
/// <param name="rot"></param>
|
||
public void ChangeCameraPos(Vector3 pos, Vector3 rot)
|
||
{
|
||
///设置人偶物体旋转,位置
|
||
kinematic.SetPositionAndRotation(pos, Quaternion.Euler(0, rot.y, 0));///设置相机旋转,位置
|
||
characterCamera.transform.rotation = Quaternion.Euler(rot.x, rot.y, 0);
|
||
characterCamera.transform.position = characterCamera.pos.transform.position;
|
||
characterCamera.ResetTR(rot);
|
||
}
|
||
private void RecognizeNewGeo(RaycastHit rayHit, string RecognizeName,string tranName)
|
||
{
|
||
if (rayHit.transform.name.Contains(RecognizeName))
|
||
{
|
||
Vector3 worldPos = rayHit.point;
|
||
PopUpMng.ShowToolInfoTip(tranName, worldPos + Vector3.up * 0.05f, -1);
|
||
}
|
||
}
|
||
}
|
||
} |