void Update()
    {
        if (Input.GetButtonDown("ShowInventory") && inventoryWindow.activeInHierarchy)
        {
            InventoryWindowRoot.Instance.ShowInventory(false);
            Cursor.visible   = false;
            Cursor.lockState = CursorLockMode.Locked;
        }
        else if (chestWindow.activeInHierarchy)
        {
            Cursor.visible   = true;
            Cursor.lockState = CursorLockMode.None;
        }
        else if (Input.GetButtonDown("ShowInventory") && !inventoryWindow.activeInHierarchy)
        {
            InventoryWindowRoot.Instance.ShowInventory(true);
            Cursor.visible   = true;
            Cursor.lockState = CursorLockMode.None;
        }
        if (Input.GetMouseButtonDown(0) && Cursor.visible && !inventoryWindow.activeInHierarchy && !chestWindow.activeInHierarchy)
        {
            Cursor.visible   = false;
            Cursor.lockState = CursorLockMode.Locked;
        }
        if (!inventoryWindow.activeInHierarchy && !chestWindow.activeInHierarchy)
        {
            if (Input.GetKey(KeyCode.W))
            {
                transform.Translate(new Vector3(Camera.main.transform.forward.x, 0, Camera.main.transform.forward.z) * moveSpeed * Time.deltaTime);
            }
            if (Input.GetKey(KeyCode.S))
            {
                transform.Translate(new Vector3(-Camera.main.transform.forward.x, 0, -Camera.main.transform.forward.z) * moveSpeed * Time.deltaTime);
            }
            if (Input.GetKey(KeyCode.A))
            {
                transform.Translate(new Vector3(-Camera.main.transform.right.x, 0, -Camera.main.transform.right.z) * moveSpeed * Time.deltaTime);
            }
            if (Input.GetKey(KeyCode.D))
            {
                transform.Translate(new Vector3(Camera.main.transform.right.x, 0, Camera.main.transform.right.z) * moveSpeed * Time.deltaTime);
            }

            Ray        ray = new Ray(Camera.main.transform.position, Camera.main.transform.forward);
            RaycastHit hit;
            Physics.Raycast(ray, out hit);
            if ((hit.collider != null) && hit.collider.GetComponent <Chest>() && (hit.distance < interactRange))
            {
                interactText.gameObject.SetActive(true);
                if (Input.GetButtonDown("InteractWithChest"))
                {
                    interactableChestInRange = hit.collider.GetComponent <Chest>();
                    interactableChestInRange.Interact();
                }
            }
            else
            {
                interactText.gameObject.SetActive(false);
            }
        }
        else if (chestWindow.activeInHierarchy && Input.GetButtonDown("InteractWithChest"))
        {
            ChestWindowRoot.Instance.ShowChest(false);
            Cursor.visible   = false;
            Cursor.lockState = CursorLockMode.Locked;
        }

        //giving item to player
        if (Input.GetKey(KeyCode.Alpha1))
        {
            GameManager.Instance.GiveItemToPlayer(Inventory.Instance.ItemDatabase.FindItem("Diamond Ore"), 1);
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            GameManager.Instance.GiveItemToPlayer(Inventory.Instance.ItemDatabase.FindItem("Silver Pickaxe"), 1);
        }
        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            GameManager.Instance.GiveItemToPlayer(Inventory.Instance.ItemDatabase.FindItem("Diamond Sword"), 1);
        }

        //giving item to chest
        if (Input.GetKey(KeyCode.Alpha4))
        {
            testChest.AddItemDull(testChest.ItemDatabase.FindItem("Diamond Ore"), 1);
        }
        if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            testChest.AddItemDull(testChest.ItemDatabase.FindItem("Silver Pickaxe"), 1);
        }
        if (Input.GetKeyDown(KeyCode.Alpha6))
        {
            testChest.AddItemDull(testChest.ItemDatabase.FindItem("Diamond Sword"), 1);
        }
    }