public void TreatmentButtonClicked() { int cost = 0; if (SelectedSlot.TreatmentSlot.TargetDiseaseQuirk != null) { cost += SelectedSlot.TreatmentSlot.BaseDiseaseCost; } if (cost != 0 || DarkestDungeonManager.Campaign.EventModifiers.IsActivityFree(SelectedSlot.activityName)) { if (SelectedSlot.TreatmentSlot.Status == ActivitySlotStatus.Checkout) { if (DarkestDungeonManager.Campaign.Estate.CanPayGold(cost)) { DarkestDungeonManager.Campaign.Estate.RemoveGold(cost); TownManager.EstateSceneManager.currencyPanel.UpdateCurrency(); TownManager.EstateSceneManager.currencyPanel.CurrencyDecreased("gold"); TownManager.GetHeroSlot(SelectedSlot.TreatmentSlot.Hero).SetStatus(HeroStatus.Sanitarium); SelectedSlot.PayoutSlot(); DarkestSoundManager.PlayOneShot("event:/town/sanitarium_disease_treatment"); ResetWindow(); } } } else { treatmentButton.gameObject.SetActive(false); costLabel.gameObject.SetActive(false); } }
public void BuyItem() { //first item were clicking if (SelectedSlot != null) { var playerItemManager = FindObjectOfType <PlayerItemManager>(); if (playerItemManager.CoinCount >= SelectedSlot.GetComponent <Slot>().Items.Peek().ItemCost) { playerItemManager.CoinCount -= SelectedSlot.GetComponent <Slot>().Items.Peek().ItemCost; SelectedSlot.GetComponent <Slot>().Items.Peek().Buy(); } } else { print("Nothing selected"); } }
public string DispenseItem() { string result = ""; //Check the slot row for the result string; if (SelectedSlot.NameOfSlot != "") { switch (SelectedSlot.NameOfSlot[0]) { case 'A': result = "Crunch Crunch, Yum!"; break; case 'B': result = "Munch Munch, Yum!"; break; case 'C': result = "Glug Glug, Yum!"; break; case 'D': result = "Chew Chew, Yum!"; break; default: break; } } //Decrement money in the vending machine by item price MoneyInTheVendingMachine -= SelectedSlot.ItemInSlot.Price; //Take an item from the slot SelectedSlot.TakeItemFromSlot(); return(result); }