private void Update()
    {
        if (Input.GetKey(KeyCode.A))
        {
            transform.Translate(Vector2.left * 10 * Time.deltaTime);
        }

        if (Input.GetKey(KeyCode.D))
        {
            transform.Translate(Vector2.right * 10 * Time.deltaTime);
        }

        if (Input.GetKeyDown(KeyCode.W))
        {
            interactionHandler.InteractAttempt(itemHandler);
        }

        if (Input.GetKeyDown(KeyCode.S))
        {
            if (itemHandler.currentItem != null)
            {
                itemHandler.UseItem(itemHandler.currentItem);
            }
            else
            {
                Debug.Log("Item usage without item");
            }
        }
    }
Esempio n. 2
0
    private void UseInput()
    {
        _movM.Move(_IM.xInput, _moveSpeed, _RB);

        if (_IM.tryInteract)
        {
            _InteractionH.InteractAttempt(_ItemH);
        }

        if (_IM.tryUse)
        {
            _ItemH.AttemptUseItem();
        }

        if (_IM.drop)
        {
            _ItemH.AttemptDrop();
        }

        if (_IM.tryJump && _onGround)
        {
            //Debug.Log("jump");
            _movM.Jump(_jumpSpeed, _RB);
        }

        _IM.tryJump     = false;
        _IM.tryInteract = false;
        _IM.tryUse      = false;
        _IM.drop        = false;
    }