コード例 #1
0
        private void Update()
        {
            if (interactionsEnabled)
            {
                if (interactionsCooling)
                {
                    interactionsCooling = false;
                    return;
                }

                if (Input.GetButtonDown(KeyCodeConsts.Use))
                {
                    OnConfirm?.Invoke(INPUT_TYPE.USE);
                    interactionController.Interact();
                }

                if (Input.GetButtonDown(KeyCodeConsts.Cancel))
                {
                    OnCancel?.Invoke(INPUT_TYPE.CANCEL);
                    interactionController.Cancel();
                }

                if (Input.GetButtonDown(KeyCodeConsts.Inventory))
                {
                    OnInventory?.Invoke(INPUT_TYPE.INVENTORY);
                }
            }
        }
コード例 #2
0
        private void OnClick(InputType type, int index, PointerEventData eventData)
        {
            switch (type)
            {
            case InputType.Target:
            {
                OnWorldClick(eventData.position);
            }
            break;

            case InputType.Inventory:
            {
                OnInventory.Invoke(index);
            }
            break;

            case InputType.Options:
            {
                OptionAction(index);
            }
            break;
            }
        }