void Start() { if (PlayerPrefs.GetString("Player Name") != "") { playerNameInput.text = PlayerPrefs.GetString("Player Name"); } tutorial.SetActive(false); PlayerPrefs.Save(); AICount = DebugMenu.Instance.GetAICount(); totalCoin = PlayerPrefs.GetInt("Total Coin"); mainCoinText.text = totalCoin.ToString("F0"); ScaleUpTitle(); if (AICount > 8) { AICount = 8; } shopCanvasScript = shopCv.transform.parent.GetComponent <ShopCanvasScript>(); ScaleDownIngame(); ScaleDownShop(); ScaleDownDebug(); for (int i = 0; i < AICount; i++) { Instantiate(AIPrefab, AISpawnPoints[i].position, AIPrefab.transform.rotation, AIS); } StopGame(); }
public void CheckPurchase(ShopCanvasScript shop) { if ((myStocks[0].demand * myStocks[0].cost) <= GMCShopScript.instance.myMoney) { GMCShopScript.instance.myMoney -= (myStocks[0].demand * myStocks[0].cost); GMCShopScript.instance.moneyDisplay.text = GMCShopScript.instance.myMoney.ToString(); bool inList = false; StockItem item = myStocks[0]; for (int i = 0; i < GMCShopScript.instance.myStocks.Count; i++) { if (GMCShopScript.instance.myStocks[i].myItem == myStocks[0].myItem) { inList = true; int demandPurchase = myStocks[0].demand; item = GMCShopScript.instance.myStocks[i]; item.stock += demandPurchase; GMCShopScript.instance.myStocks[i] = item; for (int j = 0; j < GMCShopScript.instance.weeklyLogList.Count; j++) { if (myStocks[0].myItem == GMCShopScript.instance.weeklyLogList[j].stockItems) { GMCShopScript.instance.weeklyLogList[j].currStock += demandPurchase; } } } } if (!inList) { item.stock = item.demand; GMCShopScript.instance.myStocks.Add(item); } item.demand = 0; shop.currShop.myStocks[0] = item; shop.currDemand.text = shop.currShop.myStocks[0].demand.ToString(); } }
// Use this for initialization void Start() { //uIScript = FindObjectOfType(typeof(UIScript)) as UIScript; shopCanvasScript = FindObjectOfType(typeof(ShopCanvasScript)) as ShopCanvasScript; }