// Update is called once per frame
    void Update()
    {
        switch (view)
        {
        case ViewState.GAME:
            if (Input.GetKeyDown(Game_Manager.inventoryToggle))
            {
                setState(ViewState.INVENTORY);
                timer = Time.realtimeSinceStartup;
                StartCoroutine(beginFade(durToFadeInv / 2));
                StartCoroutine(beginUnfade(durToFadeInv / 2));
            }

            if (timer != 0 && Time.realtimeSinceStartup >= timer + durToFadeInv / 2 && !toggled)
            {
                pInv.toggleUI();
                toggled = true;
            }
            if (timer != 0 && Time.realtimeSinceStartup >= timer + durToFadeInv && toggled)
            {
                timer          = 0;
                toggled        = false;
                Time.timeScale = 1;
            }
            break;

        case ViewState.INVENTORY:
            if (Input.GetKeyDown(Game_Manager.inventoryToggle))
            {
                setState(ViewState.GAME);
                timer = Time.realtimeSinceStartup;
                StartCoroutine(beginFade(durToFadeInv / 2));
                StartCoroutine(beginUnfade(durToFadeInv / 2));
            }

            if (timer != 0 && Time.realtimeSinceStartup >= timer + durToFadeInv / 2 && !toggled)
            {
                pInv.toggleUI();
                toggled = true;
            }
            if (timer != 0 && Time.realtimeSinceStartup >= timer + durToFadeInv && toggled)
            {
                timer          = 0;
                toggled        = false;
                Time.timeScale = 0;
            }
            break;
        }
    }