public void waifuMenuUnlockButton() { //Type less (It's a copy) Waifu_data waifu = Waifu_list[current_waifu]; //Just unlocks it and allows to see Select text //This changes behavour from unlock to Select (not implemented) //If it isn't unlocked and the number of points is bigger or equal to the cost if (!waifu.isUnlocked) { if (ClickerCounter.waifuPoints >= waifu.cost) { //Take Points away ClickerCounter.waifuPoints -= waifu.cost; //Change boolean to unlocked (from the data in the list, not the copy) Waifu_list[current_waifu].isUnlocked = true; } } //else it means its unlocked and should select it else { //Save index of current waifu as selected selected_waifu = current_waifu; } }
//Intended to run every frame private void changeButtonText() { //Type less Waifu_data waifu = Waifu_list[current_waifu]; if (!waifu.isUnlocked) { upgradeButton_text.text = "Unlock"; } else { upgradeButton_text.text = "Select"; if (selected_waifu == current_waifu) { upgradeButton_text.text = "Selected"; } } }
// Update is called once per frame void Update() { Save(); //Gets current Waifu selected Waifu_data currentWaifu = Waifu_list[current_waifu]; Waifu_data selectedWaifu = Waifu_list[selected_waifu]; //UI Updates changeButtonText(); //Display cost of selected waifu in Waifu Menu Upgrades.DisplayFormatedValueText(currentWaifu.cost, text_unlock_cost, singificant_figures); //Render Sprite //Changes current Waifu sprite from the Waifu List Waifu_spriteRenderer.sprite = currentWaifu.sprite; Debug.Log("Cost of waifu: " + currentWaifu.cost); //Changes selected waifu in the game Waifu_INGAME.sprite = selectedWaifu.sprite; }