private void Update()
    {
        if (timerStarted)
        {
            timer += Time.deltaTime;
            UpdateGUI();
        }

        if (gm.endGame)
        {
            if (Input.GetButtonDown("InventoryRight") || (Input.GetKeyDown(KeyCode.RightArrow)) || (Input.GetKeyDown(KeyCode.D)))
            {
                if (pageIndex == journalPages.Length - 1)
                {
                    pageIndex = journalPages.Length - 1;
                }
                else
                {
                    sounds.PlayPageTurn();
                    pageIndex++;
                }

                for (int i = 0; i < journalPages.Length; i++)
                {
                    journalPages[i].SetActive(false);
                }

                journalPages[pageIndex].SetActive(true);
            }
            if (Input.GetButtonDown("InventoryLeft") || (Input.GetKeyDown(KeyCode.LeftArrow)) || (Input.GetKeyDown(KeyCode.A)))
            {
                if (pageIndex == 0)
                {
                    pageIndex = 0;
                }
                else
                {
                    sounds.PlayPageTurn();
                    pageIndex--;
                }

                for (int i = 0; i < journalPages.Length; i++)
                {
                    journalPages[i].SetActive(false);
                }

                journalPages[pageIndex].SetActive(true);
            }
        }
    }
示例#2
0
    private void Update()
    {
        if (inventory.hasAxe)
        {
            lines[0].SetActive(true);
        }
        if (inventory.hasRod)
        {
            lines[1].SetActive(true);
        }


        if (gm.paused)
        {
            if (pageIndex == 6)
            {
                Cursor.visible = true;
            }
            else
            {
                Cursor.visible = false;
            }
        }
        else
        {
            Cursor.visible = false;
        }


        if (Input.GetButtonDown("Button Start") || Input.GetButtonDown("Button Select") || Input.GetKeyDown(KeyCode.Escape))
        {
            if (gm.paused)
            {
                sounds.PlayPageTurn();
                playerController.enabled = true;
                journalUI.SetActive(false);
                gm.ResumeGame();
                gm.paused = false;
                // close the journal
            }
            else
            {
                sounds.PlayPageTurn();
                playerController.enabled = false;
                journalUI.SetActive(true);
                gm.PauseGame();
                gm.paused = true;

                journalPages[pageIndex].SetActive(true);
            }
        }

        if (gm.paused)
        {
            if (Input.GetButtonDown("InventoryRight") || (Input.GetKeyDown(KeyCode.RightArrow)) || (Input.GetKeyDown(KeyCode.D)))
            {
                if (pageIndex == journalPages.Length - 1)
                {
                    pageIndex = journalPages.Length - 1;
                }
                else
                {
                    sounds.PlayPageTurn();
                    pageIndex++;
                }

                for (int i = 0; i < journalPages.Length; i++)
                {
                    journalPages[i].SetActive(false);
                }

                journalPages[pageIndex].SetActive(true);
            }
            if (Input.GetButtonDown("InventoryLeft") || (Input.GetKeyDown(KeyCode.LeftArrow)) || (Input.GetKeyDown(KeyCode.A)))
            {
                if (pageIndex == 0)
                {
                    pageIndex = 0;
                }
                else
                {
                    sounds.PlayPageTurn();
                    pageIndex--;
                }

                for (int i = 0; i < journalPages.Length; i++)
                {
                    journalPages[i].SetActive(false);
                }

                journalPages[pageIndex].SetActive(true);
            }
        }
    }