// Jimmy Vegas Unity Tutorial // These scripts will auto sell and spin the skybox using System.Collections; using System.Collections.Generic; using UnityEngine; public class RotateSky : MonoBehaviour { public float rotateSpeed = 0.1f; void Update () { RenderSettings.skybox.SetFloat("_Rotation", Time.time * rotateSpeed); } } using System.Collections; using System.Collections.Generic; using UnityEngine; public class AutoSell : MonoBehaviour { public bool SellingCookie = false; public static int CashIncrease = 1; public int InternalIncrease; void Update () { CashIncrease = GlobalShop.shopPerSec; InternalIncrease = CashIncrease; if (SellingCookie == false) { SellingCookie = true; StartCoroutine(SellTheCookie()); } } IEnumerator SellTheCookie () { if (GlobalCookies.CookieCount == 0) { //we can't do anything } else { GlobalCash.CashCount += InternalIncrease; GlobalCookies.CookieCount -= 1; yield return new WaitForSeconds(1); SellingCookie = false; } } } using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class GlobalShop : MonoBehaviour { public GameObject fakeButton; public GameObject fakeText; public GameObject realButton; public GameObject realText; public int currentCash; public static int shopValue = 50; public static bool turnOffButton = false; public GameObject shopStats; public static int numberOfShops; public static int shopPerSec; void Update () { currentCash = GlobalCash.CashCount; shopStats.GetComponent().text = "Shops: " + numberOfShops + " @ " + shopPerSec + " Per Second"; fakeText.GetComponent().text = "Buy Shop - $" + shopValue; realText.GetComponent().text = "Buy Shop - $" + shopValue; if (currentCash >= shopValue) { fakeButton.SetActive(false); realButton.SetActive(true); } if (turnOffButton == true) { realButton.SetActive(false); fakeButton.SetActive(true); turnOffButton = false; } } }