예제 #1
0
 public void choose()
 {
     if (PlayerPrefs.HasKey("stage" + goTo + "_unlocked"))
     {
         PlayerPrefs.SetString("chosenStage", goTo);
         changeSceneScript.GoTo = goTo;
         mainMenu.SetActive(true);
         stagesBackBtn.SetActive(false);
         btnSfxPush.Play();
         boolChangerScript.changeBoolean();
     }
     else
     {
         if (PlayerPrefs.GetInt("PlayerGold") >= itmPrice)
         {
             //buy it
             PlayerPrefs.SetInt("PlayerGold", PlayerPrefs.GetInt("PlayerGold") - itmPrice);
             PlayerPrefs.SetInt("stage" + goTo + "_unlocked", 1);
             purchase.Play();
             coin.SetActive(false);
             price.SetActive(false);
             imgPlay.SetActive(true);
             changeSceneScript.GoTo = goTo;
         }
         else
         {
             //insufficient gold
             insufficient.Play();
         }
     }
 }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        gpgScript = GetComponent <GPGScript>();

        if (!PlayerPrefs.HasKey("expEarned"))
        {
            PlayerPrefs.SetFloat("expEarned", 0.0f);
        }
        if (!PlayerPrefs.HasKey("playerLevel"))
        {
            PlayerPrefs.SetInt("playerLevel", 1);
        }
        if (!PlayerPrefs.HasKey("skillPoints"))
        {
            PlayerPrefs.SetInt("skillPoints", 1);
        }
        if (!PlayerPrefs.HasKey("swipeCap"))
        {
            PlayerPrefs.SetInt("swipeCap", 20);
        }

        insufficient = GameObject.Find("sfxInsufficientGold").GetComponent <AudioSource>();

        btnPush       = GameObject.Find("sfxBtnPush").GetComponent <AudioSource>();
        btnCharacters = GameObject.Find("Characters");
        try
        {
            boolChangerScript = btnCharacters.GetComponent <animationBoolChanger>();
        }
        catch (System.Exception)
        {
        }

        if (!PlayerPrefs.HasKey("firstSkill") && !ftStep1.activeSelf)
        {
            objmainmenu.SetActive(false);
            objtopicons.SetActive(false);
            try
            { boolChangerScript.changeBoolean(); }
            catch (Exception)
            { }
            ftStep0.SetActive(true);
            back_shop.SetActive(true);
            back_shop.GetComponent <Button>().interactable = false;
        }

        //load SP and skills
        loadSPSkills();
    }