예제 #1
0
    public bool AddEquipment(IEquipment item)
    {
        if ((!purchaseMode && stockDisplays.Count >= maxStock) || (purchaseMode && stockDisplays.Count >= maxStockPurchases))
        {
            return(false);
        }
        EquipmentStockDisplay equipmentStock = Instantiate(equipmentDisplayPrefab, stockRect.content).GetComponent <EquipmentStockDisplay>();

        equipmentStock.SetItem(item);
        stockDisplays.Add(equipmentStock);
        equipmentStocks.Add(equipmentStock);
        if (purchaseMode)
        {
            UpdateCost(item.GetBasePrice());
        }
        ResizeStockRect();
        if (stockDisplays.Count == maxStock)
        {
            ReadyToSell.Invoke(true);
        }
        return(true);
    }