Esempio n. 1
0
    public void NewGame()
    {
        PlayerPrefs.SetInt("maxLevel", 1);
        PlayerPrefs.SetInt("hasViewedInstructions", 0);
        PlayerPrefs.SetInt("hasViewedBounceInstructions", 0);
        PlayerPrefs.SetInt("hasViewedNoDrawInstructions", 0);
        PlayerPrefs.SetInt("TotalStars", 0);
        for (int i = 1; i < SceneManager.sceneCountInBuildSettings - 1; i++)
        {
            string key = "Hole" + i + "Stars";
            PlayerPrefs.SetInt(key, 0);
        }
        // Reset all customization
        for (int j = 0; j < ballCustom.transform.childCount; j++)
        {
            string key = ballCustom.transform.GetChild(j).name + "BuyState";
            PlayerPrefs.SetInt(key, 0);
        }
        for (int k = 0; k < trailCustom.transform.childCount; k++)
        {
            string key = trailCustom.transform.GetChild(k).name + "BuyState";
            PlayerPrefs.SetInt(key, 0);
        }
        // Reset ball customization to white
        PlayerPrefs.SetString("CurrentBall", "White");
        PlayerPrefs.SetInt("Trail", -1);
        PlayerPrefs.SetInt("Ball", 0);
        customizationManager.UpdateCurrentBall(0);
        customizationManager.ResetTrail();


        maxLevelUnlocked = 1;
        LoadLevel(0);
    }
Esempio n. 2
0
    /// <summary>
    /// Equips this ball customization
    /// </summary>
    private void Equip()
    {
        equip.GetComponent <Text>().text = "Equipped";

        Outline line = gameObject.AddComponent <Outline>();

        line.effectDistance  = new Vector2(3, -3);
        line.effectColor     = Color.blue;
        line.useGraphicAlpha = false;

        if (gameObject.name.Contains("Trail"))
        {
            PlayerPrefs.SetInt("Trail", id);
            customizationManager.UpdateCurrentTrail(id);
        }
        else
        {
            PlayerPrefs.SetInt("Ball", id);
            customizationManager.UpdateCurrentBall(id);
        }

        // Set the customization to be the new selection
        if (gameObject.name.Contains("Trail"))
        {
            PlayerPrefs.SetString("CurrentTrail", gameObject.name);
        }
        else
        {
            PlayerPrefs.SetString("CurrentBall", gameObject.name);
        }


        state = BuyState.Equipped;
        string key = gameObject.name + "BuyState";

        PlayerPrefs.SetInt(key, (int)state);
    }