示例#1
0
 void Start()
 {
     playerWallet = ScriptToolbox.GetInstance().GetPlayerWallet();
     inv          = InventoryManager.GetInstance().GetInventory();
     shop         = InventoryManager.GetInstance().GetShopInventory();
     shopDialogue = InventoryManager.GetInstance().GetShopDialogue();
     qntyPrompt   = InventoryManager.GetInstance().GetQuantityPrompt();
     psm          = ScriptToolbox.GetInstance().GetPlayerManager().playerStateMachine;
 }
示例#2
0
 private void GatherComponents()
 {
     inventory        = GetComponent <Inventory>();
     shop             = GetComponent <ShopInventory>();
     qntyPrompt       = GetComponent <QuantityPrompt>();
     invSlotClick     = GetComponent <InvSlotClick>();
     equipSlotClick   = GetComponent <EquipSlotClick>();
     shopSlotClick    = GetComponent <ShopSlotClick>();
     slotClickHelpers = GetComponent <SlotClickHelpers>();
     invToggle        = GetComponent <InventoryToggle>();
     shopDialogue     = GetComponent <ShopDialogue>();
     checkInvSpace    = GetComponent <CheckInventorySpace>();
 }
示例#3
0
    public void ShopSlotRightClicked(Item item)
    {
        if (item == null)
        {
            return;
        }

        ShopDialogue        shopDialogue = InventoryManager.GetInstance().GetShopDialogue();
        CheckInventorySpace invCheck     = InventoryManager.GetInstance().GetInventorySpaceChecker();

        float price = PriceChecker.AppraiseItem(item, "Purchase") * item.quantity;

        if (playerWallet.GetCurrentBalance() >= price && invCheck.CheckItem(item))
        {
            InventoryManager.GetInstance().GetShopInventory().Remove(item);
            InventoryManager.GetInstance().GetInventory().AddItem(item);
            playerWallet.Withdraw(price);
            shopDialogue.SetCurrentMessage(LoadShop.MessageType.SUCCESS);
        }
        else
        {
            shopDialogue.SetCurrentMessage(LoadShop.MessageType.INVAL_QNTY); //SHOULD BE "GENERIC_NO"
        }
    }