예제 #1
0
    //Trade Panel
    //Sell Button Function
    public void Sell_TradeButtonFunction(Slot slot)
    {
        double cashToAdd = slot.count * slot.valueCost;

        //count = 0
        slot.MinusCount(slot.count);

        //Update UI
        slot.countText.text = ShortScaleString.parseInt(slot.count);

        slot.tradeSlot.info_1           = slot.count + " x " + slot.valueCost;
        slot.tradeSlot.info_1_Text.text = slot.tradeSlot.info_1.ToString();

        slot.tradeSlot.info_2           = cashToAdd.ToString("F2");
        slot.tradeSlot.info_2_Text.text = slot.tradeSlot.info_2.ToString();

        Economy.AddCash(cashToAdd);

        //invoke callbacks
        checkColorsInRecipeTextDelegate(slots);
        checkButtonStatusDelegate(Economy.cash);
        checkTradeUIDelegate(slots);
        checkManagerUIDelegate(slots, Economy.cash);
        checkUpgreadeUIDelegate(slots, Economy.cash);
        checkSellAllButtonUIDelegate(slots);
    }
예제 #2
0
    //Sell all function: invoke in BottomPanel
    public void SellAll()
    {
        double cashToAdd = 0;

        for (int i = 0; i < slots.Length; i++)
        {
            cashToAdd += slots[i].count * slots[i].valueCost;

            //count = 0
            slots[i].MinusCount(slots[i].count);

            //Update UI
            slots[i].countText.text = ShortScaleString.parseInt(slots[i].count);
        }

        Economy.AddCash(cashToAdd);

        //invoke callbacks
        checkColorsInRecipeTextDelegate(slots);
        checkButtonStatusDelegate(Economy.cash);
        checkTradeUIDelegate(slots);
        checkManagerUIDelegate(slots, Economy.cash);
        checkUpgreadeUIDelegate(slots, Economy.cash);
        checkSellAllButtonUIDelegate(slots);
    }
예제 #3
0
 public void KillEnemy()
 {
     Destroy(gameObject);
     economy.AddCash(money);
     if (tutorialSpawn != null)
     {
         tutorialSpawn.enemyDeath++;
     }
     Debug.Log("deaths" + enemyDeaths);
 }