void Update() { if (Input.GetMouseButtonDown(1) && !EventSystem.current.IsPointerOverGameObject()) { ChestMain chest = FindChest(); if (chest) { OpenChestPanel(chest); } } }
public void DepositTo(int amount, ChestMain chest) { if (amount > OccupiedSlots) { return; } OccupiedSlots -= amount; int remaining = chest.Deposit(amount); if (remaining > 0) { OccupiedSlots += remaining; } }
void OpenChestPanel(ChestMain chest) { ChestPanel.SetChest(chest); ChestPanel.gameObject.SetActive(true); Cursor.lockState = CursorLockMode.None; }
public void SetChest(ChestMain chest) { Chest = chest; }