Пример #1
0
    private void Start()
    {
        playerController = gameObject.GetComponent <PlayerController>();
        onWeaponChange  += EquipWeapon;

        inputMaster = GameManager.instance.inputMaster;

        inputMaster.Player.Equipment.performed += (_) => inventoryUI.ToggleInventoryGUI();

        inputMaster.EquipmentGUI.Drop.performed     += (_) => DropItem();
        inputMaster.EquipmentGUI.Exit.performed     += (_) => inventoryUI.ToggleInventoryGUI();
        inputMaster.EquipmentGUI.Use.performed      += (_) => UseItem();
        inputMaster.EquipmentGUI.Navigate.performed +=
            (InputAction.CallbackContext ctx) => NavigateGUI((int)ctx.ReadValue <float>(), inventoryUI);

        inputMaster.PickupGUI.Exit.performed     += (_) => pickupUI.ToggleInventoryGUI();
        inputMaster.PickupGUI.Take.performed     += (_) => TakeItem();
        inputMaster.PickupGUI.TakeAll.performed  += (_) => TakeAllItems();
        inputMaster.PickupGUI.Navigate.performed +=
            (InputAction.CallbackContext ctx) => NavigateGUI((int)ctx.ReadValue <float>(), pickupUI);

        inputMaster.UseWeaponGUI.Confirm.performed        += (_) => ReplaceWeapon(useWeaponUI.currentlySelected);
        inputMaster.UseWeaponGUI.ConfirmWeapon1.performed += (_) => ReplaceWeapon(0);
        inputMaster.UseWeaponGUI.ConfirmWeapon2.performed += (_) => ReplaceWeapon(1);


        inventoryUI.ChangeCurrentCapacity(currentCapacity);
        inventoryUI.ChangeMaxCapacity(maxCapacity);

        for (int i = 0; i < MAX_WEAPONS; i++)
        {
            weapons[i] = fists;
        }
        onWeaponChange();
    }