Esempio n. 1
0
 void Start()
 {
     keyb        = MiddleVR.VRDeviceMgr.GetKeyboard();
     gameManager = GameObject.Find("GameManager").GetComponent <Modelisation.GameManager>();
     vrfps       = GameObject.Find("Utilisateur").GetComponent <VRFPSInputController> ();
 }
Esempio n. 2
0
    void Start()
    {
        gameManager = GameObject.Find("GameManager").GetComponent <Modelisation.GameManager>();
        menuManager = GameObject.Find("Utilisateur").GetComponent <MenuManager>();

        // Retrieve the VRManager
        VRManagerScript[] foundVRManager = FindObjectsOfType(typeof(VRManagerScript)) as VRManagerScript[];
        if (foundVRManager.Length != 0)
        {
            m_VRManager = foundVRManager[0];
        }
        else
        {
            MVRTools.Log("[X] VRMenu: impossible to retrieve the VRManager.");
            return;
        }

        // Start listening to MiddleVR events
        m_Listener = new vrEventListener(EventListener);
        MiddleVR.VRKernel.AddEventListener(m_Listener);

        // Create commands

        // General
        m_ResetButtonCommand = new vrCommand("VRMenu.ResetButtonCommand", ResetButtonHandler);
        m_ExitButtonCommand  = new vrCommand("VRMenu.ExitButtonCommand", ExitButtonHandler);

        // Mode
        modeAssisteCommand = new vrCommand("VRMenu.modeAssisteCommand", ModeAssisteHandler);
        modeLibreCommand   = new vrCommand("VRMenu.modeLibreCommand", ModeLibreHandler);

        // Scenario
        scenarioAppelCommand     = new vrCommand("VRMenu.ScenarioAppelCommand", ScenarioAppelHandler);
        scenarioInfirmierCommand = new vrCommand("VRMenu.ScenarioInfirmierCommand", ScenarioInfirmierHandler);
        scenarioInconnuCommand   = new vrCommand("VRMenu.ScenarioInconnuCommand", ScenarioInconnuHandler);

        // Create GUI
        m_GUIRendererWeb = null;

        VRWebView webViewScript = GetComponent <VRWebView>();

        if (webViewScript == null)
        {
            MVRTools.Log(1, "[X] VRMenu does not have a WebView.");
            return;
        }

        m_GUIRendererWeb = new vrGUIRendererWeb("", webViewScript.webView);

        m_Menu = new vrWidgetMenu("VRMenu.VRManagerMenu", m_GUIRendererWeb);

        // Mode
        menuChoixMode = new vrWidgetMenu("VRMenu.ChoixMode", m_Menu, "Modes");

        modeAssiste = new vrWidgetButton("VRMenu.ModeAssisteButton", menuChoixMode, "Passer en mode assisté", modeAssisteCommand);
        modeLibre   = new vrWidgetButton("VRMenu.ModeLibreButton", menuChoixMode, "Passer en mode libre", modeLibreCommand);

        // Scénario
        menuChoixScenar = new vrWidgetMenu("VRMenu.ChoixScenario", m_Menu, "Scenarios");

        scenarAppel     = new vrWidgetButton("VRMenu.ScenarAppelButton", menuChoixScenar, "Appel téléphonique", scenarioAppelCommand);
        scenarInfirmier = new vrWidgetButton("VRMenu.ScenarInfirmierButton", menuChoixScenar, "Infirmier à l'entrée", scenarioInfirmierCommand);
        scenarInconnu   = new vrWidgetButton("VRMenu.ScenarInconnuButton", menuChoixScenar, "Inconnu à l'entrée", scenarioInconnuCommand);

        // Reset and Exit
        m_ResetButton = new vrWidgetButton("VRMenu.ResetCurrentButton", m_Menu, "Reload simulation", m_ResetButtonCommand);

        m_ExitButton = new vrWidgetButton("VRMenu.ExitButton", m_Menu, "Exit simulation", m_ExitButtonCommand);
    }