Beispiel #1
0
        private void BuildSimpleDialogue()
        {
            DialogueFactory.CreateDialogLogic(this.parent, this.name, this.guid, this.showOnlyOnce);

            MessageCenterMessageType messageType;

            if (this.trigger != null)
            {
                if (!Enum.TryParse(this.trigger, out messageType))
                {
                    MessageTypes customMessageType;
                    if (!Enum.TryParse(this.trigger, out customMessageType))
                    {
                        Main.Logger.LogError("[DialogueBuilder] Invalid 'Trigger' provided.");
                    }
                    else
                    {
                        messageType = (MessageCenterMessageType)customMessageType;
                    }
                }

                DialogTrigger dialogueTrigger = new DialogTrigger(messageType, this.guid);
                dialogueTrigger.Run();
            }
        }
        public override void Run(RunPayload payload)
        {
            Main.Logger.Log($"[AddDialogueChunk] Adding encounter structure");
            EncounterLayerData     encounterLayerData = MissionControl.Instance.EncounterLayerData;
            DialogueChunkGameLogic dialogChunk        = ChunkFactory.CreateDialogueChunk($"Chunk_Dialog_{dialogChunkName}");

            dialogChunk.encounterObjectGuid = System.Guid.NewGuid().ToString();
            dialogChunk.notes = debugDescription;

            DialogueGameLogic dialogueGameLogic;

            if (fromDialogueBucket)
            {
                dialogueGameLogic = DialogueFactory.CreateBucketDialogLogic(dialogChunk.gameObject, dialogChunkName, dialogueBucketId);
            }
            else if (dialogueOverride != null)
            {
                dialogueGameLogic = DialogueFactory.CreateDialogLogic(dialogChunk.gameObject, dialogChunkName, dialogueOverride);
            }
            else
            {
                dialogueGameLogic = DialogueFactory.CreateDialogLogic(dialogChunk.gameObject, dialogChunkName, cameraTargetGuid, presetDialog, castDef);
            }

            dialogueGameLogic.encounterObjectGuid = dialogueGuid;
        }
Beispiel #3
0
        private void OnDestroy()
        {
            DialogueFactory.onCreate -= OnDialogueCreate;

            var yarnSpinner = DialogueFactory.Get(DialogueType.YarnSpinner) as YarnSpinner;

            RemoveFromFunctions(yarnSpinner);
        }
Beispiel #4
0
    private void IdentifyEmployee()
    {
        if (interactHighlighter == null)
        {
            Debug.LogError("Have you attached the highlighter to this? ");
        }
        else
        {
            if (identifyingSoundPlaying)
            {
                identifyingSoundPlaying = false;
                Game.S.globalAudioPlayer.Stop();
            }

            Person p = interactHighlighter.highlightedPerson;
            if (p == null)
            {
                return;
            }
            if (!(p is Employee))
            {
                return;
            }
            Employee employee = p as Employee;

            // Stop and look at listener
            employee.mingleTime = -MINGLE_WAIT_MAX;
            employee.FaceDirection((int)(transform.position.x - employee.transform.position.x));


            if (employee == Game.S.target)
            {
                Game.S.globalAudioPlayer.PlayOneShot(Game.S.identifySuccess);
                //We got it right!
                DialogueFactory.GenerateCorrectIdentifyDialogue(employee, this);
                Game.S.SetGameWin();
            }
            else
            {
                Game.S.globalAudioPlayer.PlayOneShot(Game.S.identifyFail);
                //Set that we've interacted with them
                employee.interacted         = true;
                employee.transform.position = employee.transform.position.Sum3(0, 0, 1f);
                interactHighlighter.people.Remove(p);
                interactHighlighter.highlightedPerson = null;
                interactHighlighter.UpdateHighlight();

                //Woops, wrong
                DialogueFactory.GenerateIncorrectIdentifyDialogue(employee, this);
                Game.S.detective.anxiety += ANXIETY_WRONG_IDENTIFY_INCREASE;
            }

            employee.GetComponent <Rigidbody2D>().velocity += new Vector2(0, 3f);

            //DialogueFactory.StartDialogue(clues, employee, this);
        }
    }
        private void BuildSimpleDialogue()
        {
            DialogueFactory.CreateDialogLogic(this.parent, this.name, this.guid, this.showOnlyOnce);

            if (this.trigger != null)
            {
                MessageCenterMessageType triggerMessageType = (MessageCenterMessageType)Enum.Parse(typeof(MessageCenterMessageType), this.trigger);
                DialogTrigger            dialogueTrigger    = new DialogTrigger(triggerMessageType, this.guid);
                dialogueTrigger.Run();
            }
        }
Beispiel #6
0
        private void Start()
        {
            var yarnSpinner = DialogueFactory.Get(DialogueType.YarnSpinner) as YarnSpinner;

            if (yarnSpinner.IsNull())
            {
                DialogueFactory.onCreate += OnDialogueCreate;
            }
            else
            {
                OnDialogueCreate(yarnSpinner);
            }
        }
Beispiel #7
0
    private void InteractWithEmployee()
    {
        if (interactHighlighter == null)
        {
            Debug.LogError("Have you attached the highlighter to this? ");
        }
        else
        {
            Person p = interactHighlighter.highlightedPerson;
            if (p == null)
            {
                return;
            }
            if (!(p is Employee))
            {
                return;
            }
            Employee employee = p as Employee;

            // Stop and look at listener
            employee.mingleTime = -MINGLE_WAIT_MAX;
            employee.FaceDirection((int)(transform.position.x - employee.transform.position.x));

            //Set that we've interacted with them
            employee.interacted         = true;
            employee.transform.position = employee.transform.position.Sum3(0, 0, 1f);
            interactHighlighter.people.Remove(p);
            interactHighlighter.highlightedPerson = null;
            interactHighlighter.UpdateHighlight();

            //Woops we're talking with our target
            if (employee == Game.S.target)
            {
                DialogueFactory.GenerateTalkingToTargetDialogue(employee, this);
                Game.S.triedToQuestionTarget = true;
                //Increase anxiety
                Game.S.detective.anxiety += ANXIETY_DIALOGUE_WITH_TARGET_INCREASE;
                if (Game.S.detective.anxiety < 1.0f)
                {
                    Game.S.SetGameWin();
                }
            }
            else
            {
                // HMMM IS A CLUE

                List <IClue> clues = new List <IClue>();
                clues.Add(ClueFactory.GenerateRandomClueFromEmployee(employee));
                foreach (var clue in clues)
                {
                    Game.S.factBook.addClue(clue.ToFactBookString());
                }

                DialogueFactory.StartDialogue(clues, employee, this);

                //Increase anxiety
                Game.S.detective.anxiety += ANXIETY_DIALOGUE_INCREASE;
            }

            employee.GetComponent <Rigidbody2D>().velocity += new Vector2(0, 3f);
        }
    }
Beispiel #8
0
        public override void VisitStart(OfficeWorld world)
        {
            this.NodeState = NodeState.ACTIVE;

            world.InternalGameEvent += this.OnInternalGameEvent;

            int nbHappyPatient = world.NbHappyPatient;

            // Create Objects
            DarkOfficeObject office = new DarkOfficeObject();

            ArrowObject        arrow        = new ArrowObject();
            BubbleHeaderObject bubbleHeader = new BubbleHeaderObject();
            BubbleTutoObject   bubbleTuto   = new BubbleTutoObject();

            ResultObject[] resultObjects = new ResultObject[nbHappyPatient];
            for (int i = 0; i < nbHappyPatient; i++)
            {
                resultObjects[i] = new ResultObject();
            }

            //BubbleTutoObject bubbleResult = new BubbleTutoObject();

            DialogueObject header = DialogueFactory.CreateDialogueFactory(30, "Docteur IPSO", TokenType.HEADER);

            header.Alias = "header";
            DialogueObject answer = DialogueFactory.CreateDialogueFactory(30, "Déplacer", TokenType.ANSWER);

            answer.Alias = "answer";
            DialogueObject question = DialogueFactory.CreateDialogueFactory(30, "Déplacer", TokenType.FIELD);

            question.Alias = "question";
            DialogueObject text = DialogueFactory.CreateDialogueFactory(30, "  pour recommencer !", TokenType.NORMAL);

            text.Alias = "text";

            DialogueObject result;

            if (world.NbHappyPatient > 1)
            {
                result = DialogueFactory.CreateDialogueFactory(60, "Vous avez rendu " + world.NbHappyPatient + " patients heureux sur " + world.NbPatient + " !", TokenType.NORMAL);
            }
            else if (world.NbHappyPatient > 0)
            {
                result = DialogueFactory.CreateDialogueFactory(60, "Vous avez rendu 1 patient heureux sur " + world.NbPatient + " !", TokenType.NORMAL);
            }
            else
            {
                result = DialogueFactory.CreateDialogueFactory(60, "Vous n'avez rendu aucun patient heureux !", TokenType.NORMAL);
            }

            result.Alias = "result";

            DialogueObject credits = DialogueFactory.CreateDialogueFactory(60, "Pierre Duchateau   Clément Romagny   François Massy", TokenType.NORMAL);

            text.Alias = "credits";

            // Create layers
            Layer background   = new Layer();
            Layer middleground = new Layer();
            Layer foreground   = new Layer();
            Layer textLayer    = new Layer();
            Layer answerLayer  = new Layer();

            // Add Resources
            List <string> resourcesToLoad = new List <string>();

            resourcesToLoad.Add(this.LevelName);
            resourcesToLoad.Add(office.Id);

            resourcesToLoad.Add(arrow.Id);
            resourcesToLoad.Add(bubbleHeader.Id);
            resourcesToLoad.Add(bubbleTuto.Id);
            if (resultObjects.Count() > 0)
            {
                resourcesToLoad.Add(resultObjects[0].Id);
            }

            resourcesToLoad.Add("normalToken");
            resourcesToLoad.Add("sanctuaryToken");
            resourcesToLoad.Add("answerToken");
            resourcesToLoad.Add("wordInserted");
            resourcesToLoad.Add("wordDroped");
            resourcesToLoad.Add("wordInserted");
            resourcesToLoad.Add("wordPicked");

            /*resourcesToLoad.Add(patient.Id);
             * resourcesToLoad.Add(toubib.Id);*/
            world.NotifyResourcesToLoad(resourcesToLoad);

            // Add Layers
            world.AddLayer(background);
            world.AddLayer(middleground);
            world.AddLayer(foreground);
            world.AddLayer(textLayer);
            world.AddLayer(answerLayer);

            // Add Objects

            /*world.AddObject(test, 0);
             * world.AddObject(patient, 0);
             * world.AddObject(toubib, 0);*/
            world.AddObject(office, 0);

            world.AddObject(arrow, 2);
            world.AddObject(bubbleHeader, 2);
            world.AddObject(bubbleTuto, 2);
            //world.AddObject(bubbleResult, 2);
            for (int i = 0; i < nbHappyPatient; i++)
            {
                world.AddObject(resultObjects[i], 2);
            }

            world.AddObject(header, 3);
            world.AddObject(question, 3);
            world.AddObject(answer, 4);
            world.AddObject(text, 3);
            world.AddObject(credits, 3);
            world.AddObject(result, 3);

            // Set Object Position.
            office.SetKinematicParameters(new Vector2f(0, 0), new Vector2f(0, 0));

            arrow.SetKinematicParameters(new Vector2f(-220, 230), new Vector2f(0, 0));

            header.SetKinematicParameters(new Vector2f(-220, -300), new Vector2f(0, 0));
            header.LaunchDialogue(2);

            answer.SetKinematicParameters(new Vector2f(-270, 150), new Vector2f(0, 0));
            answer.LaunchDialogue(2);

            question.SetKinematicParameters(new Vector2f(100, 150), new Vector2f(0, 0));
            question.LaunchDialogue(2);

            text.SetKinematicParameters(new Vector2f(200, 150), new Vector2f(0, 0));
            text.LaunchDialogue(2);

            result.SetKinematicParameters(new Vector2f(-240, -80), new Vector2f(0, 0));
            result.LaunchDialogue(2);

            credits.SetKinematicParameters(new Vector2f(-350, 300), new Vector2f(0, 0));
            credits.LaunchDialogue(2);

            float startPositionX = -((nbHappyPatient / 2f) * 140);

            for (int i = 0; i < nbHappyPatient; i++)
            {
                resultObjects[i].SetKinematicParameters(new Vector2f(startPositionX + i * 140, -20), new Vector2f(0, 0));
            }

            bubbleHeader.SetKinematicParameters(new Vector2f(-340, -360), new Vector2f(0, 0));
            bubbleTuto.SetKinematicParameters(new Vector2f(60, 110), new Vector2f(0, 0));
            //arrow.IsFocused = true;
            bubbleHeader.SetAnimationIndex(2);

            //bubbleResult.SetKinematicParameters(new Vector2f(-200, 0), new Vector2f(0, 0));
        }
Beispiel #9
0
        public override void VisitStart(OfficeWorld world)
        {
            base.VisitStart(world);

            this.levelData = Serializer.Deserialize(this.pathLevel);

            // Create Objects
            OfficeObject office = new OfficeObject();

            PatientObject patient = new PatientObject();

            patient.Alias = "main";
            ToubibObject toubib = new ToubibObject();

            toubib.Alias = "main";
            NotebookObject notebook = new NotebookObject();

            notebook.Alias = "main";
            BubbleObject bubble = new BubbleObject();

            bubble.Alias = "main";
            TimerObject timer = new TimerObject();

            timer.Alias = "main";

            QueueTalkObject queueTalk = new QueueTalkObject();

            queueTalk.Alias = "main";
            QueueDreamObject queueDream = new QueueDreamObject();

            queueDream.Alias = "main";

            //TestObject test = new TestObject();

            DialogueObject dialoguePatient = DialogueFactory.CreateDialogueFactory(60, this.levelData.PatientDialogue);

            dialoguePatient.Alias = "patient";

            DialogueObject dialogueToubib = DialogueFactory.CreateDialogueFactory(60, this.levelData.ToubibDialogue);

            dialogueToubib.Alias = "toubib";

            DialogueObject dialogueAnswer = DialogueFactory.CreateDialogueFactory(30, this.levelData.AnswerTokens);

            dialogueAnswer.Alias = "answer";

            DialogueObject dialogueSuccessAnswer = DialogueFactory.CreateDialogueFactory(60, this.levelData.PatientSuccessAnswer, TokenType.NORMAL);

            dialogueSuccessAnswer.Alias = "successAnswer";

            DialogueObject dialogueFailAnswer = DialogueFactory.CreateDialogueFactory(60, this.levelData.PatientFailAnswer, TokenType.NORMAL);

            dialogueFailAnswer.Alias = "failAnswer";

            DialogueObject dialogueComing = DialogueFactory.CreateDialogueFactory(30, "Hum, Entrez ...", TokenType.NORMAL);

            dialogueComing.Alias = "coming";

            AToken timerToken = DialogueFactory.CreateToken(string.Empty, TokenType.TIMER);

            timerToken.Alias = "main";

            // Create layers
            Layer background   = new Layer();
            Layer middleground = new Layer();
            Layer foreground   = new Layer();
            Layer textLayer    = new Layer();
            Layer answerLayer  = new Layer();

            // Add Resources
            List <string> resourcesToLoad = new List <string>();

            resourcesToLoad.Add(this.LevelName);

            resourcesToLoad.Add(office.Id);

            resourcesToLoad.Add(toubib.Id);
            resourcesToLoad.Add(patient.Id);

            resourcesToLoad.Add(notebook.Id);
            resourcesToLoad.Add(bubble.Id);

            resourcesToLoad.Add(queueTalk.Id);
            resourcesToLoad.Add(queueDream.Id);

            resourcesToLoad.Add(timer.Id);

            resourcesToLoad.Add("normalToken");
            resourcesToLoad.Add("sanctuaryToken");
            resourcesToLoad.Add("answerToken");

            resourcesToLoad.Add("lampClipped");
            resourcesToLoad.Add("wordPicked");
            resourcesToLoad.Add("bubbleClosed");
            resourcesToLoad.Add("bubbleOpened");
            resourcesToLoad.Add("wordInserted");
            resourcesToLoad.Add("wordDroped");

            resourcesToLoad.Add("dialoguePatient");
            resourcesToLoad.Add("dialogueToubib");
            resourcesToLoad.Add("dialogueReflexion");
            resourcesToLoad.Add("dialoguePatientSuccess");
            resourcesToLoad.Add("dialoguePatientFail");
            resourcesToLoad.Add("doorKnock");
            resourcesToLoad.Add("endTimer");

            resourcesToLoad.Add("validationSuccess");
            resourcesToLoad.Add("validationFail");

            /*resourcesToLoad.Add(patient.Id);
             * resourcesToLoad.Add(toubib.Id);*/
            world.NotifyResourcesToLoad(resourcesToLoad);

            // Add Layers
            world.AddLayer(background);
            world.AddLayer(middleground);
            world.AddLayer(foreground);
            world.AddLayer(textLayer);
            world.AddLayer(answerLayer);

            // Add Objects

            /*world.AddObject(test, 0);
             * world.AddObject(patient, 0);
             * world.AddObject(toubib, 0);*/
            world.AddObject(office, 0);

            world.AddObject(toubib, 1);
            world.AddObject(patient, 1);

            world.AddObject(queueTalk, 2);
            world.AddObject(queueDream, 2);

            world.AddObject(timer, 2);
            world.AddObject(timerToken, 3);

            world.AddObject(notebook, 2);
            world.AddObject(bubble, 2);

            world.AddObject(dialoguePatient, 3);
            world.AddObject(dialogueToubib, 3);
            world.AddObject(dialogueAnswer, 4);
            world.AddObject(dialogueFailAnswer, 3);
            world.AddObject(dialogueSuccessAnswer, 3);
            world.AddObject(dialogueComing, 3);

            // Set Object Position.
            office.SetKinematicParameters(new Vector2f(0, 0), new Vector2f(0, 0));

            toubib.SetKinematicParameters(new Vector2f(150, 160), new Vector2f(0, 0));
            patient.SetKinematicParameters(new Vector2f(-550, 140), new Vector2f(0, 0));

            notebook.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0));
            bubble.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0));

            queueTalk.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0));
            queueDream.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0));

            timer.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0));
            timerToken.SetKinematicParameters(new Vector2f(400, 260), new Vector2f(0f, 0f));

            queueTalk.SetAnimationIndex(1);
            queueDream.SetAnimationIndex(1);
        }
Beispiel #10
0
        public override void VisitStart(OfficeWorld world)
        {
            this.NodeState = NodeState.ACTIVE;

            world.InternalGameEvent += this.OnInternalGameEvent;

            // Create Objects
            DarkOfficeObject office = new DarkOfficeObject();

            ArrowObject        arrow        = new ArrowObject();
            BubbleHeaderObject bubbleHeader = new BubbleHeaderObject();
            BubbleTutoObject   bubbleTuto   = new BubbleTutoObject();

            DialogueObject header = DialogueFactory.CreateDialogueFactory(30, "Docteur IPSO", TokenType.HEADER);

            header.Alias = "header";
            DialogueObject answer = DialogueFactory.CreateDialogueFactory(30, "Déplacer", TokenType.ANSWER);

            answer.Alias = "answer";
            DialogueObject question = DialogueFactory.CreateDialogueFactory(30, "Déplacer", TokenType.FIELD);

            question.Alias = "question";
            DialogueObject text = DialogueFactory.CreateDialogueFactory(30, "  pour commencer !", TokenType.NORMAL);

            text.Alias = "text";

            DialogueObject credits = DialogueFactory.CreateDialogueFactory(60, "Pierre Duchateau   Clément Romagny   François Massy", TokenType.NORMAL);

            text.Alias = "credits";

            // Create layers
            Layer background   = new Layer();
            Layer middleground = new Layer();
            Layer foreground   = new Layer();
            Layer textLayer    = new Layer();
            Layer answerLayer  = new Layer();

            // Add Resources
            List <string> resourcesToLoad = new List <string>();

            resourcesToLoad.Add(this.LevelName);
            resourcesToLoad.Add(office.Id);

            resourcesToLoad.Add(arrow.Id);
            resourcesToLoad.Add(bubbleHeader.Id);
            resourcesToLoad.Add(bubbleTuto.Id);

            resourcesToLoad.Add("normalToken");
            resourcesToLoad.Add("sanctuaryToken");
            resourcesToLoad.Add("answerToken");
            resourcesToLoad.Add("wordInserted");
            resourcesToLoad.Add("wordDroped");
            resourcesToLoad.Add("wordInserted");
            resourcesToLoad.Add("wordPicked");

            /*resourcesToLoad.Add(patient.Id);
             * resourcesToLoad.Add(toubib.Id);*/
            world.NotifyResourcesToLoad(resourcesToLoad);

            // Add Layers
            world.AddLayer(background);
            world.AddLayer(middleground);
            world.AddLayer(foreground);
            world.AddLayer(textLayer);
            world.AddLayer(answerLayer);

            // Add Objects

            /*world.AddObject(test, 0);
             * world.AddObject(patient, 0);
             * world.AddObject(toubib, 0);*/
            world.AddObject(office, 0);

            world.AddObject(arrow, 2);
            world.AddObject(bubbleHeader, 2);
            world.AddObject(bubbleTuto, 2);

            world.AddObject(header, 3);
            world.AddObject(question, 3);
            world.AddObject(answer, 4);
            world.AddObject(text, 3);
            world.AddObject(credits, 3);

            // Set Object Position.
            office.SetKinematicParameters(new Vector2f(0, 0), new Vector2f(0, 0));

            arrow.SetKinematicParameters(new Vector2f(-220, 80), new Vector2f(0, 0));

            header.SetKinematicParameters(new Vector2f(-220, -280), new Vector2f(0, 0));
            header.LaunchDialogue(2);

            answer.SetKinematicParameters(new Vector2f(-270, 0), new Vector2f(0, 0));
            answer.LaunchDialogue(2);

            question.SetKinematicParameters(new Vector2f(100, 0), new Vector2f(0, 0));
            question.LaunchDialogue(2);

            text.SetKinematicParameters(new Vector2f(200, 0), new Vector2f(0, 0));
            text.LaunchDialogue(2);

            credits.SetKinematicParameters(new Vector2f(-350, 300), new Vector2f(0, 0));
            credits.LaunchDialogue(2);

            bubbleHeader.SetKinematicParameters(new Vector2f(-340, -350), new Vector2f(0, 0));
            bubbleTuto.SetKinematicParameters(new Vector2f(60, -40), new Vector2f(0, 0));
            //arrow.IsFocused = true;
            bubbleHeader.SetAnimationIndex(2);
        }
Beispiel #11
0
 public override void Build()
 {
     DialogueFactory.CreateDialogueActivator(this.parent, this.dialogueGuid);
 }