Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButtonUp("ButtonX"))
     {
         inventorySystem.Toggle();
         if (alma.isOpen)
         {
             alma.Close();
         }
     }
     if (Input.GetButtonUp("ButtonY"))
     {
         alma.Toggle();
         if (inventorySystem.isOpen)
         {
             inventorySystem.Close();
         }
     }
     if (Input.GetButtonUp("ButtonMenu"))
     {
         ui.SetActive(!ui.activeSelf);
     }
 }
    // Update is called once per frame
    void Update()
    {
        CheckPattern();
        ContinueState();
        if (playerHealth.HP <= 0)
        {
            state = GameState.GAMEOVER;
            gameoverText.enabled = true;
            StartCoroutine(Restart());
        }
        else
        {
            gameoverText.enabled = false;
        }


        if (Input.GetButtonUp("ButtonX"))
        {
            if (!alma.isOpen)
            {
                inventorySystem.Toggle();
            }
        }
        if (Input.GetButtonUp("ButtonY"))
        {
            if (alma.isOpen)
            {
                textIndex++;
                if (textIndex < texts.Length)
                {
                    almaText.text = texts [textIndex];
                }
                else
                {
                    alma.Close();
                    if (hint != null)
                    {
                        StartCoroutine(ShowHint());
                    }
                }
            }
            else
            {
                textIndex = 0;
                if (texts.Length > 0)
                {
                    almaText.text = texts [0];
                }
                alma.Open();
            }
            if (inventorySystem.isOpen)
            {
                inventorySystem.Close();
            }
        }
        if (Input.GetButtonUp("ButtonMenu"))
        {
            helper.SetActive(!helper.activeSelf);
        }
        if (Input.GetKeyDown(KeyCode.P))
        {
            Time.timeScale = 1;
        }
    }