void Awake() { if (_instance == null) _instance = this; else Destroy(gameObject); DontDestroyOnLoad(gameObject); }
public static void AddCoins(int amount) { int totalAmount = GetCoinCount() + amount; SetCoinCount(totalAmount); SpaceAdsDemo.OnCoinsAdded(amount); Debug.Log(string.Format("Added {0} coins to the inventory. Total is now {1} coins.", amount, totalAmount)); }
public static SpaceAdsDemo GetInstance() { if (_instance == null) { GameObject gO = GameObject.Find("SpaceAdsDemo"); if (gO == null) gO = new GameObject("SpaceAdsDemo"); _instance = gO.AddComponent<SpaceAdsDemo>(); } return _instance; }
void Awake() { if (_instance == null) { _instance = this; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
public static SpaceAdsDemo GetInstance() { if (_instance == null) { GameObject gO = GameObject.Find("SpaceAdsDemo"); if (gO == null) { gO = new GameObject("SpaceAdsDemo"); } _instance = gO.AddComponent <SpaceAdsDemo>(); } return(_instance); }
public static void SetCoinCount(int amount) { PlayerPrefs.SetInt(Constants.KEY_COINCOUNT, amount); SpaceAdsDemo.OnCoinCountUpdated(); }