예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(rotateItems))
        {
            inventory.RotateItem();
        }

        if (inventory.inventorySlots.Count < 1)
        {
            return;
        }

        if (Input.GetKeyDown(interacteWithItem))
        {
            interactionStarted = true;
            holdDownStartTime  = Time.time;
            LoadInteraction();
        }

        if (Input.GetKeyUp(interacteWithItem))
        {
            Interact();
        }

        if (interactionStarted)
        {
            float holdDownTime = Time.time - holdDownStartTime;
            if (holdDownTime > maxLoadTime)
            {
                Debug.Log("Max load time reached.");
                Interact();
            }
        }

        if (loadedGameObject)
        {
            loadedGameObject.transform.rotation = gameObject.transform.rotation;
            loadedGameObject.transform.position = gameObject.transform.position + loadingPositinOffset;
        }
    }