Esempio n. 1
0
    /// <summary>
    /// Parse the string from the PlayerPrefs saving and set the values accordingly.
    /// </summary>
    public void ParseSavedString(string savedString)
    {
        int index, value;

        for (int i = 0; i < savedString.Length; i++)
        {
            switch (savedString[i])
            {
            case 'H':
                i++;
                index = int.Parse(savedString[i].ToString());
                i++;
                value = int.Parse(savedString[i].ToString());
                hatObjectList[index].SetUnlocked(value == 1 ? true : false);
                i++;
                break;

            case 'C':
                i++;
                index = int.Parse(savedString[i].ToString());
                i++;
                value = int.Parse(savedString[i].ToString());
                colorObjectList[index].SetUnlocked(value == 1 ? true : false);
                i++;
                break;

            case 'P':
                i++;
                index = int.Parse(savedString[i].ToString());
                i++;
                value = int.Parse(savedString[i].ToString());
                powerupObjectList[index].SetCurrentLevel(value);
                break;

            case 'S':
                i++;
                highscore = int.Parse(savedString.Substring(i, highscoreLength));
                i        += highscoreLength;
                break;

            case 'T':
                i++;
                totalScore = int.Parse(savedString.Substring(i, totalscoreLength));
                i         += totalscoreLength;
                break;

            case 'A':
                i++;
                currentHat = (PlayerHatTypes)int.Parse(savedString[i].ToString());
                break;

            case 'O':
                i++;
                currentColor = (PlayerColorTypes)int.Parse(savedString[i].ToString());
                break;
            }
        }

        Debug.Log("Loaded string: " + savedString);
    }
Esempio n. 2
0
 public SavedData(List <HatObject> standardHatObjects, List <ColorObject> standardColorObjects, List <PowerupObject> standardPowerupObjects)
 {
     hatObjectList     = standardHatObjects;
     colorObjectList   = standardColorObjects;
     powerupObjectList = standardPowerupObjects;
     highscore         = 0;
     totalScore        = 0;
     currentHat        = PlayerHatTypes.TYPE_DEFAULT;
     currentColor      = PlayerColorTypes.COLOR_CLASSIC;
 }
Esempio n. 3
0
    /// <summary>
    /// Change the currently selected purchaseable by the players request.
    /// </summary>
    public void SelectPurchaseable(int sectionIndex, int purchaseableIndex)
    {
        currentShopSection = (ShopSection)sectionIndex;
        switch (currentShopSection)
        {
        case ShopSection.HATS:
            currentHat = (PlayerHatTypes)purchaseableIndex;
            break;

        case ShopSection.COLORSCHEME:
            currentColor = (PlayerColorTypes)purchaseableIndex;
            break;
        }
    }