示例#1
0
 private void OnTriggerStay(Collider other)
 {
     // If player pressed button while colliding with other, then show dialogue
     if (!isDisabled && other.gameObject.tag == "Player" &&
         !UIActions.UI.paused && buttonPressed && nextTime < Time.timeSinceLevelLoad)
     {
         nextTime      = Time.timeSinceLevelLoad + waitTime; // reset waiting period before advancing dialogue
         buttonPressed = false;
         if (dialogueTriggered)                              // if dialogue triggered already, advance dialogue
         {
             dialogueManager.AdvanceDialogue();
         }
         else // Else, start the dialogue
         {
             ReadTextFile();
             dialogueManager.StartDialogue(dialogue, this);
             dialogueTriggered = true;
             if (indicator != null)
             {
                 indicator.SetActive(false);
             }
         }
     }
 }
示例#2
0
    public static void Main()
    {
        bool            DEBUG = false;
        DialogueManager sys   = new DialogueManager();

        sys.LoadDialogue(0);
        Dictionary <string, string> placeHolderArt = new Dictionary <string, string>();

        placeHolderArt.Add("HeroSurprised", "'o'");
        placeHolderArt.Add("HeroBored", "'-'");
        placeHolderArt.Add("HeroContemplative", "'.'?");
        placeHolderArt.Add("HeroLetDown", ";-;");

        placeHolderArt.Add("HeroineBored", "()'-')");
        placeHolderArt.Add("HeroineSurprised", "()'O')");
        placeHolderArt.Add("HeroineContemplative", "()'.')?");
        placeHolderArt.Add("HeroinePuzzled", "~()?.?)~");

        bool gameLoop = true;

        while (gameLoop)
        {
            string positionPadding = "                                              ";
            int    newLineCount    = 30;
            for (int i = 0; i < newLineCount; i++)
            {
                Console.Write("\n");
            }
            Console.Write(placeHolderArt[sys.currentDialogue.leftSprite]);
            Console.Write(positionPadding + placeHolderArt[sys.currentDialogue.rightSprite] + "\n\n");

            if (sys.currentDialogue.currentSpeaker == "right")
            {
                Console.WriteLine(positionPadding + sys.currentDialogue.name);
            }
            else
            {
                Console.WriteLine(sys.currentDialogue.name);
            }
            Console.WriteLine(sys.currentDialogue.message);
            if (sys.currentDialogue.hasChoice)
            {
                Console.WriteLine("");
                Console.WriteLine("Enter Your Choice: ");

                for (int i = 0; i < sys.currentDialogue.choices.Count; i++)
                {
                    Console.WriteLine(i + "). " + sys.currentDialogue.choices[i].message);
                }

                while (true)
                {
                    PrintDebugInfo(DEBUG, sys);
                    int input = Int32.Parse(Console.ReadLine());

                    if (input < sys.currentDialogue.choices.Count && input > -1)
                    {
                        sys.ProcessDialogueCommand(sys.currentDialogue.choices[input]);
                        break;
                    }
                }
            }
            else
            {
                PrintDebugInfo(DEBUG, sys);
                Console.ReadLine();
            }

            gameLoop = !sys.currentDialogue.isEnd;
            sys.AdvanceDialogue();
        }
    }