Пример #1
0
    public static void setActiveSprite(int choice)
    {
        ballStates[0] = true;
        ballStates[1] = true;
        DialogScript dialogScript = new DialogScript();

        if (ballStates[choice])
        {
            selectedSpriteIndex = choice;
            string key = "ballSpriteIndex";
            PlayerPrefs.SetInt(key, selectedSpriteIndex);
        }
        else
        {
            int cost;
            if (choice < 10)
            {
                cost = 100;
            }
            else
            {
                cost = 200;
            }
            int coins;
            coins = GameOverScript.getCoins();
            if (coins >= cost)
            {
                coins -= cost;
                string key = "coins";
                PlayerPrefs.SetInt(key, coins);
                ballStates[choice] = true;
                PlayerPrefs.SetInt(ballKeys[choice], 1);
            }
            else if (coins < cost)
            {
                dialogScript.showDialog("You don't have enough coins. Sorry");
            }
        }
    }