Exemple #1
0
    void Update()
    {
        bool xKey               = Input.GetKey(KeyCode.X);
        bool xDownKey           = Input.GetKeyDown(KeyCode.X);
        bool joyInteractKey     = Input.GetKey("joystick button 1");
        bool joyInteractDownKey = Input.GetKeyDown("joystick button 1");

        botaoCorrida = Input.GetKey(KeyCode.Z);
        joyCorrida   = Input.GetKey("joystick button 2");

        if (Input.GetKeyUp(KeyCode.Z))
        {
            StopCoroutine(ParouDeCorrer());
            StartCoroutine(ParouDeCorrer());
        }
        else
        {
            if (podeRespirarUpdate)
            {
                RecuperaFolego();
            }
        }


        Corre();


        //Sistema de Pânico
        if (emPanico)
        {
            EntraEmPanico(0.005f);
        }

        if ((xDownKey || joyInteractKey) && canDialogue && isDialoguing == false)
        {
            readTrigger.TriggerDialogue();
        }

        if (canUseDoor && (xDownKey || joyInteractDownKey))
        {
            if (door.GetIsLocked())
            {
                somEvento.Invoke();
                string key = door.GetKeyName();
                if (inventario.GetItemInventário(key))
                {
                    door.Unlock();
                    door.DoorEnter(gameObject);
                }
            }
            else
            {
                door.DoorEnter(gameObject);
            }
        }
    }