/*************************************************************************** * PassiveUnit state changes **************************************************************************/ /// <summary> /// Buys one more of this unit type /// </summary> public void PurchaseUnit() { CoolerCookieClicker resourceManager = CoolerCookieClicker.Instance; if (resourceManager.currency >= priceToPurchase) { // buy unit resourceManager.purchasepool += priceToPurchase; resourceManager.AddToPassive(powerRatePerQuantity); quantity++; // increase price priceToPurchase *= priceGrowthRate; // update the power gen rate TotalPowerRate = powerRatePerQuantity * quantity; // if there isn't a reference to that unit yet, add it //if (!resourceManager.unitList.ContainsKey(unitType)) //{ // resourceManager.unitList.Add(unitType, this); //} // update the UI UpdateUI(); } }