Esempio n. 1
0
    void Awake()
    {
        if (_instance == null) _instance = this;
        else Destroy(gameObject);

        DontDestroyOnLoad(gameObject);
    }
Esempio n. 2
0
    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));
    }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
    void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Esempio n. 5
0
 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);
 }
Esempio n. 6
0
    public static void SetCoinCount(int amount)
    {
        PlayerPrefs.SetInt(Constants.KEY_COINCOUNT, amount);

        SpaceAdsDemo.OnCoinCountUpdated();
    }