Exemple #1
0
    IEnumerator BeginGame()
    {
        //Wait one frame so everything is initialized.
        yield return(null);

        //Initialize the database.
        ResourceDatabase.InitializeDatabase();

        //Default profession (TEMPORARY)
        GameData.SetPlayerProfession(ResourceDatabase.GetRaceByParameter("Agent"));

        //Use the init sequence to initialize everything.
        StartCoroutine(InitializationSequence.instance.LoadEverything());
    }
Exemple #2
0
    IEnumerator SetProfessionDialogue()
    {
        switch (GetComponent <GameData> ().currentLevel)
        {
        case 0:
            //Dramatic pause
            yield return(new WaitForSeconds(2));

            //Stone Age Speech
            yield return(StartCoroutine(mainProfessionSpeechManager.SetSpeechDialogue(
                                            bertieHead,
                                            new string[] {
                "" + GetComponent <GameData> ().specifiedPlayerName + "?",
                "Are you all right?",
                "Thank goodness you are still alive!",
                "But I don't think we're in the twenty-fifth century anymore...",
                "I am not sure how it happened, but the time machine malfunctioned.",
                "It shot us to a point in time I am not programmed to understand.",
                "Along the way, it fell apart after reaching terminal velocity, thankfully keeping us intact.",
                "Pieces of it are now strewn across many parts of history.",
                "You have to help me fix it.  If you can help me gather the pieces, I will be able to repair it.",
                "I don't see any other way.",
                "But I'll have to disguise you as a native of this period in time, so that you fit in.",
                "I'll let you choose who you become, then give you what you need to become that person.",
                "As we gather more pieces, I should be able to push us farther into the future.",
                "...",
                "...I sure hope my battery lasts long enough to get us to a time period with electricity..."
            }
                                            )));

            //For the Stone Age
            yield return(StartCoroutine(mainProfessionChoiceManager.CreateProfessionChoice("Choose your Ice Age Profession.",
                                                                                           ResourceDatabase.GetRaceByParameter("Spear Fighter"), "Spear Fighter",
                                                                                           ResourceDatabase.GetRaceByParameter("Mace Fighter"), "Mace Fighter"
                                                                                           )));

            //Get the profession
            GetComponent <GameData> ().chosenProfession = mainProfessionChoiceManager.GetChosenProfession();

            //Give a bit more of an intro
            yield return(StartCoroutine(mainProfessionSpeechManager.SetSpeechDialogue(
                                            bertieHead,
                                            new string[] {
                "You'll have to figure out how to use your weapon.",
                "The basic controls are handled by the mouse.",
                "Good luck!"
            }
                                            )));

            //Load the Ice Age
            SceneManager.LoadScene("Ice Age");

            break;

        case 1:
            Debug.LogError("No real profession choice exists for this level!");
            //Just use the default ice age thing.
            yield return(StartCoroutine(mainProfessionSpeechManager.SetSpeechDialogue(
                                            bertieHead,
                                            new string[] {
                "Nice job dealing with those cavemen!",
                "I have an important announcement for you.",
                "While mining deep underground, we have discovered a new metal.",
                "We call it Bronze.",
                "Use the new tools created by this metal to your advantage."
            }
                                            )));

            //For the Iron Age
            yield return(StartCoroutine(mainProfessionChoiceManager.CreateProfessionChoice("Choose your Iron Age Profession.",
                                                                                           ResourceDatabase.GetRaceByParameter("Spear Fighter"), "Spear Fighter",
                                                                                           ResourceDatabase.GetRaceByParameter("Mace Fighter"), "Mace Fighter"
                                                                                           )));

            //Get the profession
            GetComponent <GameData> ().chosenProfession = mainProfessionChoiceManager.GetChosenProfession();

            //Load the Iron Age (when it exists)
            SceneManager.LoadScene("Iron Age");

            break;

        default:
            Debug.LogError("No profession choice available for level " + GetComponent <GameData> ().currentLevel);
            break;
        }
    }