public void MakePurchase() { //If the item is an automator or accelerator switch (itemType) { case ItemTypes.AUTOMATOR: //If it is bought with money or loose change switch (thisAutomator.moneyType) { case MoneyTypes.MONEY: //Take away the cost from the player's money and make the effect of the item take place //Then increase the price of the item (in order to make it still purchasable) GS.DecreaseMoney(totalCost); GS.AddAutoClick(thisAutomator.numberClicks); thisAutomator.IncreasePrice(); break; case MoneyTypes.LOOSECHANGE: GS.DecreaseLooseChange(totalCost); GS.AddAutoClick(thisAutomator.numberClicks); thisAutomator.IncreasePrice(); break; } break; case ItemTypes.ACCELERATOR: switch (thisAccelerator.moneyType) { case MoneyTypes.MONEY: GS.DecreaseMoney(totalCost); GS.AddMoneyPerClick(thisAccelerator.clickAdd); thisAccelerator.IncreasePrice(); break; case MoneyTypes.LOOSECHANGE: GS.DecreaseLooseChange(totalCost); GS.AddMoneyPerClick(thisAccelerator.clickAdd); thisAccelerator.IncreasePrice(); break; } break; } UpdateBuyButton(); SFXManager.instance.PlayEffect(SoundEffectNames.DINGONE); }
public void DailyRewardButton() { //If the player hasn't collected their daily reward yet if(!GS.collectedDailyReward) { //Provide them with the results of the reward according to its effect switch (todaysReward.effect) { case Item.Effect.ADDMONEY: GS.IncreaseMoney(todaysReward.effectStrength); break; case Item.Effect.ADDAUTOMATORS: GS.AddAutoClick(todaysReward.effectStrength); break; case Item.Effect.ADDLOOSECHANGE: GS.IncreaseLooseChange(todaysReward.effectStrength); break; } //Let the game state know they have collected it //And increment the reward counter so that tomorrow the reward will be different GS.collectedDailyReward = true; ++GS.currentDailyReward; if(GS.currentDailyReward >= GS.dailyRewards.Length) { GS.currentDailyReward = 0; } //Let them know that collecting the reward was successful notifyText.text = "Daily reward collected. Get another one tomorrow!"; SFXManager.instance.PlayEffect(SoundEffectNames.FANFARETWO); foreach (ParticleSystem PS in fireworks) { PS.Play(); } } else { //Remind the player they have already collected their daily reward notifyText.text = "You have already collected your daily reward!"; SFXManager.instance.PlayEffect(SoundEffectNames.BUTTON); } }