Esempio n. 1
0
 void Awake()
 {
     _instance         = this;
     actuatorModelName = new List <string>();
     gm     = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManagerT2>();
     uiCtrl = gm.GetComponent <UIControllerT2>();
 }
Esempio n. 2
0
    /// <summary>
    /// 创建新场景
    /// </summary>
    public void CreateNewScene(SubjectType sjType, OperateType opType)
    {
        //实例化PC和VR必备物体
        DeskCanvasGameObject    = Instantiate(DeskCanvasGamePrefab);
        StartUICanvasGameObject = Instantiate(StartUICanvasPrefab);
        GameObject EventSystemGameObject     = Instantiate(eventSystemGamePrefab);
        GameObject VRTK_SDKManagerGameObject = Instantiate(VRTK_SDKManagerPrefab);
        GameObject VRTK_ScriptsGameObject    = Instantiate(VRTK_ScriptsPrefab);

        //加载场景所需必要的脚本和物体
        gm = Instantiate(GameManager).GetComponent <GameManagerT2>();
        gm.InitCameraGameObject(GameObject.Find("Main Camera"), VRTK_SDKManagerGameObject, VRTK_ScriptsGameObject);
        gm.subjectType = sjType;

        uiCtrl = gm.GetComponent <UIControllerT2>();
        uiCtrl.InitUICanvas(StartUICanvasGameObject, DeskCanvasGameObject,
                            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;
    }