Example #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.isTrigger)
        {
            return;
        }
        DialogueSystem d = collision.GetComponentInParent <DialogueSystem>();

        if (d != null)
        {
            foreach (var i in itemsToQueue)
            {
                d.Enqueue(i);
            }
            var c = d.GetComponent <CarController>();
            if (doBrake)
            {
                c.isRunning = false;
                d.Enqueue(new DialogueSystem.DialogueItem("", "", 0.001f, d.OnStart));
            }
            if (oneShot)
            {
                gameObject.SetActive(false);
            }
        }
    }
Example #2
0
        public int ShowDialogue(string characterName, string text, params string[] options)
        {
            DialogueSystem.Enqueue(new DialogueData()
            {
                CharacterName = characterName,
                Text          = text,
                Options       = options,
            });

            bool dialogueIsDone = false;
            int  optionChosen   = -1;

            DialogueSystem.OnDialogueEnd += delegate(int code){
                optionChosen   = code;
                dialogueIsDone = true;
            };

            while (!dialogueIsDone)
            {
                Thread.Sleep(100);
            }

            return(optionChosen);
        }