Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        spellController = cam.GetComponent <SpellController>();
        spellController.setIsControlDisabled(true);

        for (int i = 0; i < dialogs.Length; i++)
        {
            dialogDict.Add(dialogs[i], new bool[] { false, false });
        }

        // display initial dialog
        dialogs[0].gameObject.SetActive(true);
        dialogDict[dialogs[0]][0] = true;
        dialogIndex++;
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        if ((training_CastSpell_Started && !training_CastSpell_Completed) && GameObject.FindGameObjectsWithTag("Monster").Length < 1)
        {
            training_CastSpell_Completed = true;
        }

        if ((training_Cube_Started && !training_Cube_Completed) || (training_CastSpell_Started && !training_CastSpell_Completed))
        {
            return;
        }

        if (dialogDict[dialogs[dialogIndex - 1]][0] && !checkActivity(dialogs[dialogIndex - 1]))
        {
            dialogDict[dialogs[dialogIndex - 1]][1] = true;

            if (!training_Cube_Completed && dialogs[dialogIndex - 1].gameObject.name == "dialogQueue_AimAtBoxes")
            {
                training_Cube_Started = true;
                SpawnCubes();
            }

            if (!training_MakeSpell_Completed && dialogs[dialogIndex - 1].gameObject.name == "dialogQueue_MakeSpells")
            {
                spellController.setIsControlDisabled(false);
                training_MakeSpell_Started = true;
                if (checkHandSpellSingleHand())
                {
                    training_MakeSpell_Completed = true;
                }
            }

            if (!training_MakeSpell2_Completed && dialogs[dialogIndex - 1].gameObject.name == "dialogQueue_MakeSpells2")
            {
                training_MakeSpell2_Started = true;
                if (checkHandSpellBothHand())
                {
                    training_MakeSpell2_Completed = true;
                }
            }

            if (!training_CastSpell_Completed && dialogs[dialogIndex - 1].gameObject.name == "dialogQueue_TriggerSpells")
            {
                training_CastSpell_Started = true;
                SpawnCubes();
            }

            if (!training_GLHF_Completed && dialogs[dialogIndex - 1].gameObject.name == "dialogQueue_GLHF")
            {
                training_GLHF_Started = true;
            }
        }

        if (dialogs[dialogIndex - 1].gameObject.name == "dialogQueue_GLHF" && dialogDict[dialogs[dialogIndex - 1]][1])
        {
            SceneManager.LoadScene("GameStart");
        }

        // When index is out of bond, do not load the next dialog
        if (dialogIndex > dialogs.Length - 1)
        {
            return;
        }

        if (dialogDict[dialogs[dialogIndex - 1]][1] &&
            (!training_Cube_Started || (training_Cube_Started && training_Cube_Completed)) &&
            (!training_MakeSpell_Started || (training_MakeSpell_Started && training_MakeSpell_Completed)) &&
            (!training_MakeSpell2_Started || (training_MakeSpell2_Started && training_MakeSpell2_Completed)) &&
            (!training_CastSpell_Started || (training_CastSpell_Started && training_CastSpell_Completed))
            )
        {
            dialogs[dialogIndex].gameObject.SetActive(true);
            dialogDict[dialogs[dialogIndex]][0] = true;

            dialogIndex++;
        }
    }