Beispiel #1
0
    /* Updates PlayerController and handles other non-movement related input. If player is reading
     * (inventory.isReading == true) no other input will be accepted and instead inventory.ReadSelected()
     * will be called until finished reading. */
    public void ExUpdate()
    {
        playerController.ExUpdate();

        if (inventory.isReading || (Input.GetKeyDown(KeyCode.R) && lantern.isLit))
        {
            if (!normalReading && intMan.inRangeInteractable != null && intMan.inRangeInteractable.tag == "Victim")
            {
                if (!inventory.isReading)
                {
                    transform.Find("Chant Sound").GetComponent <AudioSource>().Play();  // When we start reading
                    intMan.ToggleInteractionPrompt(false);
                }
                inventory.ReadSelected("Chant");  // Sets inventory.isReading to false, if we just finished reading
                // Rescue attempt when ReadSelected() sets isReading to false
                if (!inventory.isReading)
                {
                    ((Victim)intMan.inRangeInteractable).Rescue(inventory.GetScrollContent());
                    transform.Find("Chant Sound").GetComponent <AudioSource>().Stop();
                }
            }
            else
            {
                inventory.ReadSelected("Read");
                if (!inventory.isReading)
                {
                    normalReading = false;
                }
                else
                {
                    normalReading = true;
                }
            }

            playerController.unableToMove = inventory.isReading;
        }
        else if (Input.GetKeyDown(KeyCode.E) && (intMan.inRangeInteractable != null))
        {
            intMan.inRangeInteractable.Interact();
        }
        else if (Input.GetKeyDown(KeyCode.Tab))
        {
            inventory.Browse();
        }
        else if (Input.GetKeyDown(KeyCode.Space))
        {
            if (lantern.isLit || inventory.ExpandMatch())
            {
                lantern.ToggleLight();
            }
        }
        else if (Input.GetKeyDown(KeyCode.Q))
        {
            infoBox.Continue();
        }
        else if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Z))
        {
            print("Pause input in player");
            GameController.instance.Pause();
        }
    }