Exemplo n.º 1
0
 public void buyUpgrade(Upgrade upgradeType, float upgradeValue, int upgradeLevel)
 {
     if (upgradeType.level < 5 && MoneyManager.Instance.money.Amount >= upgradeType.Price)
     {
         upgradeType.Value += upgradeValue;
         upgradeType.level += upgradeLevel;
         MoneyManager.Instance.money.Amount -= upgradeType.Price;
         jsonLoader.SaveJson(upgrades, upgradeSavepath);
         jsonLoader.SaveJson(MoneyManager.Instance.money, "/money.cash");
     }
 }
Exemplo n.º 2
0
    public void onsnap()
    {
        if (System.IO.File.Exists(Application.persistentDataPath + "/money.cash"))
        {
            Data m = jsonLoader.LoadJson(MoneyManager.Instance.money, "/money.cash");
            if (m is Money)
            {
                MoneyManager.Instance.money = (Money)m;
            }
        }
        else
        {
            MoneyManager.Instance.money = new Money(0);
            jsonLoader.SaveJson(MoneyManager.Instance.money, "/money.cash");
            Debug.Log("created new json");
        }

        snappedPieces++;
        if (pieces <= snappedPieces)
        {
            jsonLoader = new JsonLoader();
            Data m = jsonLoader.LoadJson(MoneyManager.Instance.money, "/money.cash");
            if (m is Money)
            {
                MoneyManager.Instance.money = (Money)m;
            }

            //MoneyManager.Instance.money.Amount =

            Debug.Log("jeeejj je hebt de puzzle af");
            MoneyManager.Instance.money.Amount += 100;
            jsonLoader.SaveJson(MoneyManager.Instance.money, "/money.cash");
            Debug.Log(MoneyManager.Instance.money.Amount);
        }
    }
Exemplo n.º 3
0
    void Awake()
    {
        CheckPanels();

        //Instantiate or load Json File
        jsonLoader = new JsonLoader();
        if (System.IO.File.Exists(Application.persistentDataPath + upgradeSavepath))
        {
            Data d = jsonLoader.LoadJson(upgrades, upgradeSavepath);
            if (d is Upgrades)
            {
                upgrades = (Upgrades)d;
            }
        }
        else
        {
            upgrades = new Upgrades();
            jsonLoader.SaveJson(upgrades, upgradeSavepath);
            Debug.Log("created new json");
        }

        if (System.IO.File.Exists(Application.persistentDataPath + "/money.cash"))
        {
            Data m = jsonLoader.LoadJson(MoneyManager.Instance.money, "/money.cash");
            if (m is Money)
            {
                MoneyManager.Instance.money = (Money)m;
            }
        }
        else
        {
            MoneyManager.Instance.money = new Money(0);
            jsonLoader.SaveJson(MoneyManager.Instance.money, "/money.cash");
            Debug.Log("created new json");
        }


        upgrades.MaxFuelUpgrade.Price     = 150;
        upgrades.MoveSpeedUpgrade.Price   = 200;
        upgrades.SlideLengthUpgrade.Price = 100;
        upgradePriceText.text             = "$ " + upgrades.MoveSpeedUpgrade.Price;


        InitiateIndicators();
        Debug.Log(MoneyManager.Instance.money.Amount);
    }