public void buySeed() //the function that handles buying a seed { if (coinScript.getCurrentCoins() >= currentPlant.Price) //if the player has enough coins to buy a new seed { if (seedHandlerScript.seedCheck()) //if already holding a seed that hasn't been planted, refund it { coinScript.gainCoins(seedHandlerScript.whatSeedIsHeld().Price); //find how much coins to refund and give it back to the player } coinScript.spendCoins(currentPlant.getPrice()); //spends coins to buy new seed seedHandlerScript.holdSeed(currentPlant); //puts new seed in hand uiControler.closeAll(); //closes all panels so the player can plant the new seed } }