public void toggleMenu()
 {
     memoryPairing.PlayBackToMenu();
     if (menuPanel.activeSelf)
     {
         menuPanel.SetActive(false);
         eventSystem.SetSelectedGameObject(lastselect);
     }
     else
     {
         //Release cursor
         Cursor.lockState = CursorLockMode.None;
         //Change cursor to visible again
         Cursor.visible = true;
         menuPanel.SetActive(true);
         lastselect = eventSystem.currentSelectedGameObject;
         eventSystem.SetSelectedGameObject(GameObject.Find("Continuar"));
     }
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        //Store the selected card if something is selected
        if (eventSystem.currentSelectedGameObject != null)
        {
            lastselect = eventSystem.currentSelectedGameObject;
        }

        if (Input.GetKeyDown(KeyCode.RightArrow))    //Moving
        {
            MoveRight();
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            MoveLeft();
        }
        else if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            MoveUp();
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            MoveDown();
        }
        else if (Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.Return))    //Submit
        {
            Submit();
        }
        else if (Input.GetMouseButtonDown(0))    //To not bug the selection system
        {
            eventSystem.SetSelectedGameObject(lastselect);
        }
        else if (Input.GetKeyDown(KeyCode.Q))     //Direct access
        {
            Access(0, 0);
        }
        else if (Input.GetKeyDown(KeyCode.W))
        {
            Access(0, 1);
        }
        else if (Input.GetKeyDown(KeyCode.E))
        {
            Access(0, 2);
        }
        else if (Input.GetKeyDown(KeyCode.R))
        {
            Access(0, 3);
        }
        else if (Input.GetKeyDown(KeyCode.A))
        {
            Access(1, 0);
        }
        else if (Input.GetKeyDown(KeyCode.S))
        {
            Access(1, 1);
        }
        else if (Input.GetKeyDown(KeyCode.D))
        {
            Access(1, 2);
        }
        else if (Input.GetKeyDown(KeyCode.F))
        {
            Access(1, 3);
        }
        else if (Input.GetKeyDown(KeyCode.Z))
        {
            Access(2, 0);
        }
        else if (Input.GetKeyDown(KeyCode.X))
        {
            Access(2, 1);
        }
        else if (Input.GetKeyDown(KeyCode.C))
        {
            Access(2, 2);
        }
        else if (Input.GetKeyDown(KeyCode.V))
        {
            Access(2, 3);
        }
        else if (Input.GetKeyDown(KeyCode.J))
        {
            PlayerLocation();
        }
        else if (Input.GetKeyDown(KeyCode.Escape))
        {
            memoryPairing.PlayBackToMenu();
            //Release cursor
            Cursor.lockState = CursorLockMode.None;
            //Change cursor to visible again
            Cursor.visible = true;
            SceneManager.LoadScene(0);
        }
    }