Esempio n. 1
0
 void UpdatePause()
 {
     if (controlScript.device == ControlType.VRDevices.OculusRift)
     {
         if (Input.GetButtonDown("RightJoystickClick"))
         {
             if (!pauseScript.paused)
             {
                 pauseScript.Pause();
             }
             else
             {
                 pauseScript.UnPause();
             }
         }
     }
     else if (controlScript.device == ControlType.VRDevices.Vive)
     {
         if (Input.GetButtonDown("B"))
         {
             if (!pauseScript.paused)
             {
                 pauseScript.Pause();
             }
             else
             {
                 pauseScript.UnPause();
             }
         }
     }
 }
 public void OnClick()
 {
     if (settingsPanel.activeInHierarchy)
     {
         settingsPanel.SetActive(false);
         if (photoButton != null)
         {
             photoButton.SetActive(true);
         }
         if (nextButton != null)
         {
             nextButton.SetActive(true);
         }
         configPanel.SetActive(false);
         backgroundImage.overrideSprite = menuOffSprite;
         menuToggle.IsOn = false;
     }
     else
     {
         backgroundImage.overrideSprite = menuOffSprite;
         if (pauseScript != null)
         {
             pauseScript.Pause();
         }
     }
 }
Esempio n. 3
0
    void Update()
    {
        if (InputManager.ActiveDevice.MenuWasPressed && pauseMenu.activeInHierarchy)
        {
            if (pauseScript.Unpause())
            {
                pauseMenu.SetActive(false);
            }
        }
        else if (InputManager.ActiveDevice.MenuWasPressed)
        {
            pauseMenu.SetActive(true);
            pauseScript.Pause();
        }


        switch (state)
        {
        case update_status.REGULAR_UPDATE:

            lag = Time.deltaTime;
            break;

        case update_status.UPDATE_REQUESTED:

            doUpdate = true;
            state    = update_status.UPDATING;
            break;

        case update_status.UPDATING:
            doUpdate = false;
            state    = update_status.WAITING;
            break;
        }
    }
    public void OnMouseDown()
    {
        pauser.Pause(false);


        GetComponent <Outline>().enabled = false;
    }
Esempio n. 5
0
 ///
 /// \brief Called when the escape key is pressed
 ///
 /// \return No return value
 ///
 /// \details Will close the top most window or pause if no window is open
 ///
 public void onEsc()
 {
     if (windows.Count > 0)
     {
         _closeWindow();
     }
     else
     {
         PauseScript.Pause();
     }
 }
//		void PauseGame ()
//		{
//			//applciation code for objects inside of the main menu scene
//			if (Application.loadedLevelName == "Level 01") {
//				PauseScript pauseGame = shootHit.collider.GetComponent<PauseScript> ();
//				if (pauseGame) {
//					Debug.Log ("PAUSE GAME");
//				}
//			}
//		}
        void IngameMenuOptions()
        {
            if (Application.loadedLevelName == "Level 01")
            {
                RaycastHit hit;
                Ray        ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f));
                if (Physics.Raycast(ray, out hit, 100f, LayerMask.GetMask("InGameMenu")))
                {
                    InGameMenu ingamemenu_temp = hit.collider.GetComponent <InGameMenu> ();
                    if (Application.loadedLevelName == "Level 01")
                    {
                        if (ingamemenu_temp)
                        {
                            if (hit.point.x < 1.5f)
                            {
                                if (pausescript.pausegame != true)
                                {
                                    pausescript.Pause();
                                }
                            }
                            if (hit.point.x > 1.51f && hit.point.x < 1.9f)
                            {
                                if (restartscript.RestartLevel != true)
                                {
                                    restartscript.RestartLevel = true;
                                }
                            }
                            if (hit.point.x > 1.91f)
                            {
                                mainmenuscript.MainMenuToggle = true;
                            }
                        }
                    }
                }



//				RestartScript restartLevel = shootHit.collider.GetComponent<RestartScript> ();
//				InGameMenu restartLevel = shootHit.collider.GetComponent<InGameMenu> ();
//				if (restartLevel) {
//					Debug.Log ("RESTART GAME METHOD");
//					restartscript.RestartLevel = true;
//				}
            }
        }
Esempio n. 7
0
    void SpawnRule()        //This function spawns the rules in the form of UI text components (these are prefabs)
    {
        pauser.Pause(true); //stops time in game world

        Debug.Log("DIS Rule count is:" + RuleSpawnCounter);


        var ruleText = Instantiate(Rules[RuleSpawnCounter], Rules[RuleSpawnCounter].position, Rules[RuleSpawnCounter].rotation); //instantiates the rule UI text component prefab and gives it a variable name to be referenced

        ruleText.transform.SetParent(GameObject.FindGameObjectWithTag("rulesCanvas").transform, false);                          // places the UI text component as a child of the Rules Canvas (already on scene)


        if (RuleSpawnCounter == 1)
        {
            Debug.Log("Turn on Zone 1 in Z1 Script");
            zone1On.Zone1TurnOn();
            Debug.Log("Turn on Zone 1 in Z0 Script");
            zone0Update.Zone1TurnedOn();
        }
        else if (RuleSpawnCounter == 2)
        {
            zone2On.Zone2TurnOn();
            zone0Update.Zone2TurnedOn();
        }
        else if (RuleSpawnCounter == 3)
        {
            zone3On.Zone3TurnOn();
            zone0Update.Zone3TurnedOn();
        }

        RuleSpawnCounter++;


        if (RuleSpawnCounter > Rules.Length - 1) //stops the rule spawning once it is out of rules
        {
            CancelInvoke("SpawnRule");           //Cancels this specific invocation
            //Debug.Log("Stop it with all of these rules!");
        }
    }