Exemplo n.º 1
0
 IEnumerator WaitForKeyDownStart()
 {
     ui.ShowTextHolder();
     while (true)
     {
         if (Input.GetKeyDown(KeyCode.Return))
         {
             if (allowingInput)
             {
                 if (toSay != null && toSay.updateFlagName != null && toSay.updateFlagName != "")
                 {
                     party.flags[toSay.updateFlagName] = toSay.updateFlagValue;
                 }
                 if (toSay != null && toSay.initiateBattle)
                 {
                     ui.HideTextHolder();
                     owner.ResetLoc(toSay.newResetLocation);
                     SceneMgmt.SetToFight(toSay.encounterPrefab, toSay.arenaPrefab, SceneManager.GetActiveScene().name, GameObject.Find("Player").transform.position);
                     //SceneMgmt.LoadScene("Battle");
                     yield break;
                 }
                 if (toSay != null && toSay.endBranch)
                 {
                     ui.HideTextHolder();
                     owner.ResetLoc(toSay.newResetLocation);
                     if (toSay.destroyAfterDialogue)
                     {
                         GameObject.Destroy(owner.gameObject);
                     }
                     yield break;
                 }
                 toSay = owner.GetNextNode();
                 if (toSay != null)
                 {
                     if (toSay.togglePartyMember)
                     {
                         party.GetUnitStats(toSay.partyMemberToToggle).available = !party.GetUnitStats(toSay.partyMemberToToggle).available;
                     }
                     if (toSay.mustHaveFlagToContinue != null && toSay.mustHaveFlagToContinue != "")
                     {
                         if (!party.flags[toSay.mustHaveFlagToContinue])
                         {
                             ui.HideTextHolder();
                             owner.ResetLoc(toSay.newResetLocation);
                             yield break;
                         }
                     }
                     if (toSay.mustNotHaveFlagToContinue != null && toSay.mustNotHaveFlagToContinue != "")
                     {
                         if (party.flags[toSay.mustNotHaveFlagToContinue])
                         {
                             ui.HideTextHolder();
                             owner.ResetLoc(toSay.newResetLocation);
                             yield break;
                         }
                     }
                     if (toSay.showChoice)
                     {
                         Advance();
                         ui.SetChoiceText(toSay.yesText, toSay.noText);
                         ui.ShowChoiceHolder();
                         allowingInput = false;
                     }
                     else
                     {
                         Advance();
                     }
                 }
                 else
                 {
                     ui.HideTextHolder();
                     owner.ResetLoc(toSay.newResetLocation);
                     yield break;
                 }
             }
         }
         yield return(null);
     }
 }