void SaveLevelInfo(int worldIndex, float p_levelScore, float p_levelMaxScore)
    {
        float goldAmount = GM.GetGold() * PE.GetGoldMultiplier();

        FH.WriteGoldAmount(goldAmount.ToString());

        bool p_completed;

        if (m_score > GM.GetMedalValue(0) * maxScore)
        {
            p_completed = true;
        }
        else
        {
            p_completed = false;
        }

        string fileDirectory;

        fileDirectory = "/world_" + worldIndex.ToString() + "_data.txt";
        fileDirectory = Application.dataPath + fileDirectory;
        if (!File.Exists(fileDirectory)) // If the file is there
        {
            int index = Application.loadedLevel;
            for (int u = 0; u < 10; u++)
            {
                System.IO.File.WriteAllText(fileDirectory, "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n ");
            }
            var lines = File.ReadAllLines(fileDirectory);
            lines[index] = Convert.ToInt32(p_completed).ToString() + ':' + p_levelScore.ToString() + ':' + p_levelMaxScore.ToString();
            File.WriteAllLines(fileDirectory, lines);
        }
        else
        {
            int index = Application.loadedLevel;
            var lines = File.ReadAllLines(fileDirectory);
            lines[index] = Convert.ToInt32(p_completed).ToString() + ':' + p_levelScore.ToString() + ':' + p_levelMaxScore.ToString();
            File.WriteAllLines(fileDirectory, lines);
        }
    }
Beispiel #2
0
    //    Bronze: 25 gold, 4k flour score.
    //    Silver: 50 gold, 5500 flour score.
    //    Gold: 100 gold, 7500 flour score.
    //    Master: 200 gold, 9000 flour score.

    //    Swapping a potion: 150 gold. TEST THIS.
    //    Unlocking base upgrade: Expensive, start at 1000. Double every new tier; 1000 -> 2k -> 4k etc… MAKE EM F*****G WORK FOR IT.
    //    Cool upgrades at first rank and then every other rank, alternate with other buildings

    int CalculateRemainingParticlesForNextMedal()
    {
        if (WBH.GetScore() < GM.GetMedalValue(0) * WBH.GetMaxScore())  //Bronze
        {
            m_multiplier = WBH.GetMaxScore() * GM.GetMedalValue(0);
        }
        else if (WBH.GetScore() < GM.GetMedalValue(1) * WBH.GetMaxScore())   // Silver
        {
            m_multiplier = WBH.GetMaxScore() * GM.GetMedalValue(1);
        }
        else if (WBH.GetScore() < GM.GetMedalValue(2) * WBH.GetMaxScore())   // gold
        {
            m_multiplier = WBH.GetMaxScore() * GM.GetMedalValue(2);
        }
        else if (WBH.GetScore() < GM.GetMedalValue(3) * WBH.GetMaxScore())  // master
        {
            m_multiplier = WBH.GetMaxScore() * GM.GetMedalValue(3);
        }
        float answer = m_multiplier - WBH.GetScore();

        return((int)answer);
    }