예제 #1
0
    public void Progress()
    {
        //print(ChapterProgress);
        if (SelectedChapter >= Chapters.Count)
        {
            return;
        }

        if (mgm.GlobalLocationManager.GetCurrentLocation().Distance(Chapters[SelectedChapter].location) > 0.1f)
        {
            print("Too Far away");
            return;
        }

        string won = PlayerPrefs.GetString("MGameState");

        if (won.Equals("won"))
        {
            ChapterProgress++;
            print("Hurra, you won the game.");
        }
        else if (won.Equals("lost"))
        {
            print("Oh No, you lost.");
        }

        PlayerPrefs.SetString("MGameState", "none");

        if (Chapters[SelectedChapter].pTexts.ContainsKey(ChapterProgress))
        {
            PlainText pText = Chapters[SelectedChapter].pTexts[ChapterProgress];
            //print("Text: " + pText.text);
            mgm.DisplayPlainText(pText.text, mgm.CharacterManager.Characters[pText.charID]);
        }
        else if (Chapters[SelectedChapter].events.ContainsKey(ChapterProgress))
        {
        }
        else if (Chapters[SelectedChapter].mGame.ContainsKey(ChapterProgress))
        {
            mgm.SaveLoadManager.SaveChapterProgress(SelectedChapter, 0, ChapterProgress);
            mgm.StartMiniGame(Chapters[SelectedChapter].mGame[ChapterProgress].miniSpielID);
            //print("Minigame " + Chapters[SelectedChapter].mGame[ChapterProgress].miniSpielID);
            //PlayerPrefs.SetString("MGameState", "won");
        }
        else
        {
            mgm.DisplayPlainText("Das Kapitel ist vorbei.", mgm.CharacterManager.Characters["AG"]);
            ChapterProgress = 0;
            SelectedChapter++;
        }

        ChapterProgress++;
    }