/// <summary> /// 获取GM /// </summary> /// <returns></returns> private void GetGameManager() { GameObject _gm = GameObject.FindGameObjectWithTag("GameManager"); if (_gm) { gm = _gm.GetComponent <GameManagerT1>(); uiCtrl = _gm.GetComponent <UIControllerT1>(); //Debug.Log("获取T1 gm"); } else { //Debug.Log("GameManager物体不存在"); } }
/// <summary> /// 创建新场景 /// </summary> public void CreateNewScene(SubjectType sjType, OperateType opType) { //实例化PC和VR必备物体 StartUICanvasGameObject = Instantiate(StartUICanvasPrefab); infoBoardParentTransform = Instantiate(InfoBoardParent).transform; unitParentTransform = Instantiate(UnitParent).transform; GameObject EventSystemGameObject = Instantiate(EventSystem); DesktopGameCanvasGameObject = Instantiate(DesktopGameCanvasPrefab); GameObject VRTK_SDKManagerGameObject = Instantiate(VRTK_SDKManagerPrefab); GameObject VRTK_ScriptsGameObject = Instantiate(VRTK_ScriptsPrefab); //属性赋值 gm = Instantiate(GameManager).GetComponent <GameManagerT1>(); gm.InitCameraGameObject(GameObject.Find("Main Camera"), VRTK_SDKManagerGameObject, VRTK_ScriptsGameObject); gm.subjectType = sjType; //操作交互方式由课件启动的时候决定,这里不在定义 //gm.operateType = opType; uiCtrl = gm.GetComponent <UIControllerT1>(); uiCtrl.InitUICanvas(StartUICanvasGameObject, DesktopGameCanvasGameObject, VRTK_SDKManagerGameObject.transform.GetChild(0).GetChild(3).GetChild(0).GetChild(0).gameObject, VRTK_SDKManagerGameObject.transform.GetChild(0).GetChild(3).GetChild(0).GetChild(3).GetChild(0).GetChild(0).gameObject); VRTK_SDKManagerGameObject.GetComponent <VRTK_SDKManager>().scriptAliasLeftController = VRTK_ScriptsGameObject.transform.Find("LeftController").gameObject; VRTK_SDKManagerGameObject.GetComponent <VRTK_SDKManager>().scriptAliasRightController = VRTK_ScriptsGameObject.transform.Find("RightController").gameObject; ClearIntroPart(); ClearShowTransformPart(); ClearUnitPart(); }