public void StartBuilding(string buttonContent) { Debug.Log("button click: " + buttonContent); if (buttonContent == "add-stall") { if (PlayerEconomy.Money >= Prices.GetStallConstructionPrice(unlockedStalls)) { PlayerEconomy.PayMoney(Prices.GetStallConstructionPrice(unlockedStalls)); //enable GO, construction stalls [unlockedStalls].gameObject.SetActive(true); stalls [unlockedStalls].underConstruction.SetActive(true); for (int i = 0; i < stalls [unlockedStalls].finished.Length; ++i) { stalls [unlockedStalls].finished [i].SetActive(false); } //store in duration dict. index is nr of unlocked stalls constructionDaysRemainingPerStallIndex.Add(unlockedStalls, Durations.GetStallConstructionDuration(unlockedStalls)); UI.instance.constructionUI.underConstructionDaysRemaining.text = constructionDaysRemainingPerStallIndex[unlockedStalls].ToString() + " " + GetDayPluralSingular(constructionDaysRemainingPerStallIndex[unlockedStalls]) + " remaining"; unlockedStalls++; UI.instance.constructionUI.hideOnConstruction.SetActive(false); UI.instance.constructionUI.showOnConstruction.SetActive(true); } else { Debug.Log("not enough money for stall construction!"); } } }
private void LoadGame() { //read file into a Save BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + saveFilePath, FileMode.Open); Save save = (Save)bf.Deserialize(file); file.Close(); day = save.day; HayCart[] carts = FindObjectsOfType <HayCart> (); for (int i = 0; i < carts.Length; ++i) { if (carts [i].fillType == equippableItemID.HAY) { carts [i].InitOrRestockCart(save.hayCartFill); } else if (carts [i].fillType == equippableItemID.STRAW) { carts [i].InitOrRestockCart(save.strawCartFill); } } FindObjectOfType <ConstructionBook> ().SetUnlockedStallsFromSave(save.unlockedStallUnits, save.buildingsUnderConstruction, save.paddockPartitions); PlayerEconomy.LoadMoneyFromSave(save.money); StartNewDay(); }
public override void PlayerInteracts(Player player) { base.PlayerInteracts(player); if (currentlyRelevantActionIDs.Count > selectedInteractionIndex) { switch (currentlyRelevantActionIDs [selectedInteractionIndex]) { case actionID.TALK_TO: UI.instance.ShowDialogue(Dialogues.RetrieveDialogue(TimeLogic.day, characterId, DialogueID.GREETING) [0], portrait, characterId, Dialogues.RetrieveReward(TimeLogic.day, characterId, DialogueID.GREETING)); if (characterId == Character.GRANDMA) { Quests.instance.FulfilledQuestCondition(QuestTask.TALK_TO_GRANDMA); } break; case actionID.SELL: Equippable item = player.currentlyEquippedItem; PlayerEconomy.ReceiveMoney(Prices.GetPriceByID(player.currentlyEquippedItem.id)); player.UnequipEquippedItem(false, true); Destroy(item.gameObject); break; } } }
public void ContinueInDialogue() { //eventually, this needs to handle multi-line dialogues //tie dialogues in sequences somehow? //actually get reward upon continuing switch (currentReward.rewardType) { case RewardType.MONEY: PlayerEconomy.ReceiveMoney(currentReward.rewardAmount); break; default: break; } //if (this line is last in sequence){ inventoryUI.transform.position = regularInvPos.position; dialogueBox.SetActive(false); if (lastRelevantPlayer != null) { lastRelevantPlayer.allowPlayerInput = true; } dialogueIsVisible = false; currentReward.rewardType = RewardType.NONE; }
// Start is called before the first frame update void Awake() { playerEconomy = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEconomy>(); text = GetComponent <Text>(); cakes = playerEconomy.currentCakes; }
// Start is called before the first frame update void Awake() { playerEconomy = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEconomy>(); text = GetComponent <Text>(); storage = playerEconomy.storedCakes; }
void callForPurchase() { OnObjectPurchase?.Invoke(currentBuyObject); OnObjectSatisfaction?.Invoke(currentBuyObject.SatisfactionGain); PlayerEconomy.createPurchase(currentBuyObject.BuyName, -currentBuyObject.BuyValue); currentBuyObject = null; }
public virtual void PrepareFood() { if (PlayerDataHolder.Current.PlayerMoney.getValue <float>() >= cost) { PlayerDataHolder.Current.Foodamount.ChangeStat(increaseAmount); PlayerEconomy.createPurchase("Ruokakauppareissut", -cost, true); } else { MainCanvas.mainCanvas.createEconomyWarning(); } }
float CalculatedPerusOmaVastuu() //Omavastuu ei vaikuta, jos tulot ovat liian pieniä... //Oletus on siinä että pelaaja asuu yksin. { float value = 0; float calculatedTotalIncome = 0; calculatedTotalIncome += PlayerEconomy.getAllIncomeSourceGrossTotals(1); if (calculatedTotalIncome > maximumGrossIncomeWhereOmaVastuuDoesNotDecreaseSupportAmount) { value = 0.42f * (calculatedTotalIncome - (603 + 100)); //Pelkistetty laskukaava, mutta simulaatiossa oletetaan se, että opiskelijalla ei ole lapsia, tai muita ruokakuntalaisia. (asuu yksin) return(value); } else { return(value); } }
void Awake() { player = GameObject.FindGameObjectWithTag("Player"); playerEconomy = player.GetComponent <PlayerEconomy>(); }
protected void IncreaseIncome() { playerEconomy = GameObject.Find("PlayerBase").GetComponent <PlayerEconomy>(); playerEconomy.generationRate += rateIncrease; }
void UpdateUI() { incomeEconomyText.text = (PlayerEconomy.totalSpeculatedNetIncomeInAMonth() + " euroa/kk"); expenseEconomyText.text = (PlayerDataHolder.Current.getTotalCosts()) + " euroa/kk"; }
private void RefillHayCart() { PlayerEconomy.PayMoney(refillPrice); cartToRestock.InitOrRestockCart(cartToRestock.currentUnits + refillUnits); }
public void Save(PlayerEconomy economy) { PlayerPrefs.SetInt("coins", economy.Coins); }