示例#1
0
    // -----------------------------------------------------------------------//

    // THESE ARE TESTING FUNCTIONS !!!!!!!!!

    public void toggleSparring()
    {
        // if Sparring = true, set false
        if (Sparring)
        {
            prefs.SavePrefBool("SparringMatch", false);
        }
        else // if false, set true
        {
            prefs.SavePrefBool("SparringMatch", true);
        }
        cheapoUpdate();
    }
    // -----------------------------------------------------------------------//

    // Start is called before the first frame update
    void Start()
    {
        // Set correct values
        SparringR2EXP = 250;
        SparringR1EXP = 500;
        MatchR2EXP    = 3000;
        MatchR1EXP    = 6000;
        MaxEXPR2      = 3000;
        MaxEXPR1      = 6000;

        exitButton.enabled = false;
        exitButton.GetComponent <Image>().enabled = false;

        PlayerRank = PlayerPrefs.GetInt("PlayerRank");
        rankText.GetComponent <Text>().text = "" + PlayerRank;

        Sparring  = prefs.getAbilityTF("SparringMatch");
        PlayerEXP = PlayerPrefs.GetInt("PlayerEXP");
        TotalEXP  = PlayerPrefs.GetInt("TotalEXP");
        MaxedOut  = checkMaxed();


        if (Sparring)
        {
            if (MaxedOut)
            {
                GiveThisMuchEXP = 0;
                expText.GetComponent <Text>().text = "+" + GiveThisMuchEXP + "\n" + PlayerEXP;
            }
            else
            {
                // Do sparing-only code
                SparringMatchSetup();

                // Turn Sparring off in player prefs
                prefs.SavePrefBool("SparringMatch", false);
            }
        }
        else
        {
            // Real Match set-up
            TrueMatchSetup();
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        Scene s = SceneManager.GetActiveScene();

        if (s.buildIndex == 6 || s.name == "6Sparring")
        {
            // Debug.Log("You are in Scene 6!");
            bool doSparring;
            prefs.SavePrefBool("SparringMatch", true);
            doSparring = prefs.GetPrefBool("SparringMatch");
            Debug.Log("Sparring Status set to: " + doSparring);
            sceneChanger.GoSceneNumber(sceneNum);
        }
    }
    // -----------------------------------------------------------------------//

    void TrueMatchSetup()
    {
        if ((PlayerRank - 1) > 0) // New Player Rank will be > 0 (ie. hasn't won game yet.)
        {
            // Decrease rank as player wins
            PlayerRank--;
            // Save rank across scenes
            //            PlayerPrefs.SetInt("PlayerRank", PlayerRank);
            prefs.SavePref("PlayerRank", PlayerRank);

            if (PlayerRank == 2) // player goes 3->2
            {
                GiveThisMuchEXP = MatchR2EXP;

                prefs.GainEXP(MatchR2EXP);
            }
            if (PlayerRank == 1)
            {
                GiveThisMuchEXP = MatchR1EXP;

                prefs.GainEXP(MatchR1EXP);
            }

            expText.GetComponent <Text>().text = "+" + GiveThisMuchEXP + "\n" + PlayerEXP;
        }
        else if (PlayerRank > 3)
        {
            Debug.Log("PLAYER RANK IS TOO HIGH; SOMETHING BROKEN");
        }
        else // New Player rank 0 ie <1
        {
            rankText.GetComponent <Text>().text = "";
            expText.GetComponent <Text>().text  = "";

            // Player Beat Game!
            prefs.SavePrefBool("BeatGame", true);
//            PlayerPrefs.SetInt("BeatGame", 1);

            // Load Beat Game Scene (no delay)
            sceneChanger.GoSceneNumber(2);
        }
    }
示例#5
0
 private void Start()
 {
     prefs.SavePrefBool("BeatGame", false);
 }