コード例 #1
0
    ////////////////////////////////////////////////////////////

    public void EndGame()
    {
        if (dataManager != null)
        {
            dataManager.AddLog("Killed: " + Cannonball.GetKillCount());
            dataManager.AddLog("Coins collected : " + TreasureChestDropzone.coins);
            dataManager.AddLog("Chests stolen: " + TreasureChestDropzone.chestsStolen);

            dataManager.ChangeSaveValue(ESave_Values_Keys.HIGHEST_KILLSAMOUNT, Cannonball.GetKillCount());
            dataManager.ChangeSaveValue(ESave_Values_Keys.HIGHEST_COINSAMOUNT, TreasureChestDropzone.coins);
            dataManager.ChangeSaveValue(ESave_Values_Keys.HIGHEST_TREASURECHESTAMOUNT, TreasureChestDropzone.chestsStolen);

            dataManager.SetHighScore(Cannonball.GetKillCount() + TreasureChestDropzone.coins);

            foreach (Quest quest in questList)
            {
                if (quest.currentStage >= quest.questConditions.Length)
                {
                    continue;
                }

                if (quest.questConditions[quest.currentStage].conditionID == Quest_Conditions.EARNEDXCOINSONEPLAY && TreasureChestDropzone.coins >= quest.questConditions[quest.currentStage].x)
                {
                    quest.currentStage++;
                }
            }

            dataManager.ReplaceQuests(questList);
        }

        PlayerPrefs.SetFloat("Beer_Multiplier", 1.0f);

        SceneManager.LoadScene(0);
    }
コード例 #2
0
    ////////////////////////////////////////////////////////////

    void AddHighScore(int index, int _score)
    {
        highscore_Scores[index] = _score;

        string deathState = " ";

        if (GameObject.Find("Player").GetComponent <PlayerController>().health < 0)
        {
            deathState = "Died ";
        }
        else
        {
            deathState = "Escaped ";
        }

        string difficulty = "Normal";

        if (gameValues.difficulty == 0)
        {
            difficulty = "Easy";
        }
        else if (gameValues.difficulty == 2)
        {
            difficulty = "Hard";
        }

        string time = " Time " + System.DateTime.Now.ToString("hh:mm:ss");
        string date = " Date " + System.DateTime.Now.ToString("yyyy/MM/dd");

        //REMEMBER TO REPLACE VERSION!!!
        string scoreText = deathState + "with "
                           + TreasureChestDropzone.coins
                           + " coins, killed " + Cannonball.GetKillCount()
                           + " enemies - Difficulty: " + difficulty
                           + "\n- Version Alpha 0.1.5 " + date + time;

        highscore_Strings[index] = scoreText;
        if (highscores.ContainsKey(_score))
        {
            highscores.Remove(_score);
            highscores.Add(_score, scoreText);
        }
        else
        {
            highscores.Add(_score, scoreText);
        }
    }