Пример #1
0
        public override void UpdateLogic(OfficeWorld world, Time timeElapsed)
        {
            this.timeElapsed += timeElapsed;

            if (this.timeElapsed > periodPhase)
            {
                switch (this.moment)
                {
                case PrePhaseMoment.START:
                    AObject bubble = world.GetObjectFromId("bubble main");
                    bubble.SetAnimationIndex(1);

                    AObject toubib = world.GetObjectFromId("toubib main");
                    toubib.SetAnimationIndex(3);

                    this.moment      = PrePhaseMoment.BUBBLE_APPEARED;
                    this.periodPhase = Time.FromSeconds(1.2f);
                    this.timeElapsed = Time.Zero;
                    break;

                case PrePhaseMoment.BUBBLE_APPEARED:
                    DialogueObject dialogue = world.GetObjectFromId("dialogue coming") as DialogueObject;
                    dialogue.SetKinematicParameters(new Vector2f(-380f, dialogue.GetHeight(-150)), new Vector2f(0f, 0f));
                    dialogue.LaunchDialogue(1);

                    AObject queueTalk = world.GetObjectFromId("queueTalk main");
                    queueTalk.SetKinematicParameters(new Vector2f(100f, 100f), new Vector2f(0f, 0f));

                    bubble = world.GetObjectFromId("bubble main");
                    bubble.SetAnimationIndex(2);
                    this.moment = PrePhaseMoment.START_TALKING;
                    break;

                case PrePhaseMoment.TEXT_APPEARED:
                    dialogue = world.GetObjectFromId("dialogue coming") as DialogueObject;
                    dialogue.ResetDialogue();

                    bubble = world.GetObjectFromId("bubble main");
                    bubble.SetAnimationIndex(3);

                    queueTalk = world.GetObjectFromId("queueTalk main");
                    queueTalk.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0));

                    this.timeElapsed = Time.Zero;
                    this.periodPhase = Time.FromSeconds(1);
                    this.moment      = PrePhaseMoment.END;
                    break;

                case PrePhaseMoment.END:
                    this.NodeState = NodeState.NOT_ACTIVE;
                    break;
                }
            }
        }
Пример #2
0
        public override void VisitStart(OfficeWorld world)
        {
            base.VisitStart(world);

            world.NbPatient++;

            AObject patient = world.GetObjectFromId("patient main");
            AObject toubib  = world.GetObjectFromId("toubib main");

            //AObject test = world.GetObjectFromId("test");

            patient.SetAnimationIndex(1);
            toubib.SetAnimationIndex(2);

            DialogueObject dialogue = world.GetObjectFromId("dialogue patient") as DialogueObject;

            dialogue.SetKinematicParameters(new Vector2f(-100f, -200f), new Vector2f(0f, 0f));

            this.periodPhase = Time.FromSeconds(3);
            this.timeElapsed = Time.Zero;
        }
Пример #3
0
        public override void VisitStart(OfficeWorld world)
        {
            base.VisitStart(world);

            AObject patient = world.GetObjectFromId("patient main");
            AObject toubib  = world.GetObjectFromId("toubib main");

            patient.SetAnimationIndex(3);
            toubib.SetAnimationIndex(2);

            DialogueObject dialogue = world.GetObjectFromId("dialogue patient") as DialogueObject;

            dialogue.ResetDialogue();
            //dialogue.SetKinematicParameters(new Vector2f(-100f, -200f), new Vector2f(0f, 0f));

            DialogueObject dialogueToubib = world.GetObjectFromId("dialogue toubib") as DialogueObject;

            dialogueToubib.SetKinematicParameters(new Vector2f(-380f, dialogueToubib.GetHeight(-150)), new Vector2f(0f, 0f));

            AObject queueTalk = world.GetObjectFromId("queueTalk main");

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

            AObject noteblock = world.GetObjectFromId("notebook main");

            (noteblock as NotebookObject).SetTransition(new Vector2f(-600, 600), new Vector2f(0, -150), Time.FromSeconds(3));

            AObject bubble = world.GetObjectFromId("bubble main");

            bubble.SetAnimationIndex(1);

            AObject timer = world.GetObjectFromId("timer main");

            timer.SetAnimationIndex(1);
            timer.SetKinematicParameters(new Vector2f(320, 200), new Vector2f(0f, 0f));

            this.periodPhase = Time.FromSeconds(1.2f);
            this.timeElapsed = Time.Zero;
        }
Пример #4
0
        public override void VisitStart(OfficeWorld world)
        {
            base.VisitStart(world);

            AObject patient = world.GetObjectFromId("patient main");
            AObject toubib  = world.GetObjectFromId("toubib main");

            AObject bubble = world.GetObjectFromId("bubble main");

            //bubble.SetKinematicParameters(new Vector2f(-520f, -380f), new Vector2f(0f, 0f));

            patient.SetAnimationIndex(2);
            toubib.SetAnimationIndex(1);

            bubble.SetAnimationIndex(1);

            DialogueObject dialogue = world.GetObjectFromId("dialogue patient") as DialogueObject;

            dialogue.SetKinematicParameters(new Vector2f(-380f, dialogue.GetHeight(-150)), new Vector2f(0f, 0f));

            this.periodPhase = Time.FromSeconds(1.2f);
            this.timeElapsed = Time.Zero;
        }
Пример #5
0
        public override void VisitStart(OfficeWorld world)
        {
            base.VisitStart(world);

            AObject patient = world.GetObjectFromId("patient main");
            AObject toubib  = world.GetObjectFromId("toubib main");

            AObject bubble = world.GetObjectFromId("bubble main");

            bubble.SetKinematicParameters(new Vector2f(-520f, -380f), new Vector2f(0f, 0f));

            patient.SetAnimationIndex(6);
            toubib.SetAnimationIndex(2);

            DialogueObject dialogue = world.GetObjectFromId("dialogue patient") as DialogueObject;

            dialogue.SetKinematicParameters(new Vector2f(-100f, -200f), new Vector2f(0f, 0f));

            world.NotifyGameStateChanged(world.CurrentLevel.LevelName, new GameEvent(EventType.START, string.Empty));

            this.periodPhase = Time.FromSeconds(2);
            this.timeElapsed = Time.Zero;
        }
Пример #6
0
        public override void UpdateLogic(OfficeWorld world, Time timeElapsed)
        {
            this.timeElapsed += timeElapsed;

            if (this.timeElapsed > periodPhase)
            {
                switch (this.moment)
                {
                case ThinkPhaseMoment.START:
                    DialogueObject dialogue = world.GetObjectFromId("dialogue toubib") as DialogueObject;
                    dialogue.LaunchDialogue(6);

                    AObject queueDream = world.GetObjectFromId("queueDream main");
                    queueDream.SetKinematicParameters(new Vector2f(100f, 100f), new Vector2f(0f, 0f));

                    AObject bubble = world.GetObjectFromId("bubble main");
                    bubble.SetAnimationIndex(2);

                    this.timeElapsed = Time.Zero;
                    this.periodPhase = Time.FromSeconds(2);
                    this.moment      = ThinkPhaseMoment.BUBBLE_APPEARED;
                    break;

                case ThinkPhaseMoment.BUBBLE_APPEARED:

                    DialogueObject dialogueAnswer = world.GetObjectFromId("dialogue answer") as DialogueObject;
                    dialogueAnswer.SetKinematicParameters(new Vector2f(-550f, 200f), new Vector2f(0f, 0f));
                    dialogueAnswer.LaunchDialogue(6);

                    this.timeElapsed = Time.Zero;
                    this.periodPhase = Time.FromSeconds(world.CurrentLevel.Data.Timer);

                    AObject timer = world.GetObjectFromId("timer main");
                    timer.SetAnimationIndex(2);

                    this.moment = ThinkPhaseMoment.START_TIMER;
                    break;

                case ThinkPhaseMoment.START_TIMER:

                    this.EndTimerAction(world);
                    break;

                case ThinkPhaseMoment.END:
                    dialogue = world.GetObjectFromId("dialogue toubib") as DialogueObject;
                    dialogue.ValidateDialogue(world);

                    timer = world.GetObjectFromId("timer main");
                    timer.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0f, 0f));

                    this.NodeState = NodeState.NOT_ACTIVE;
                    break;
                }
            }

            if (this.moment == ThinkPhaseMoment.START_TIMER)
            {
                AToken timerToken = world.GetObjectFromId("timerToken main") as AToken;
                timerToken.DisplayText = ((int)(world.CurrentLevel.Data.Timer - this.timeElapsed.AsSeconds())).ToString();
            }
        }
Пример #7
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));
        }
Пример #8
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);
        }
Пример #9
0
        public override void UpdateLogic(OfficeWorld world, Time timeElapsed)
        {
            this.timeElapsed += timeElapsed;

            if (this.timeElapsed > periodPhase)
            {
                DialogueObject dialogue = null;
                switch (this.moment)
                {
                    case ResolvePhaseMoment.START:
                        if (this.isSuccess)
                        {
                            dialogue = world.GetObjectFromId("dialogue successAnswer") as DialogueObject;
                        }
                        else
                        {
                            dialogue = world.GetObjectFromId("dialogue failAnswer") as DialogueObject;
                        }
                        dialogue.SetKinematicParameters(new Vector2f(-380f, dialogue.GetHeight(-150)), new Vector2f(0f, 0f));
                        dialogue.LaunchDialogue(2);

                        AObject queueTalk = world.GetObjectFromId("queueTalk main");
                        queueTalk.SetKinematicParameters(new Vector2f(-200f, 120f), new Vector2f(0f, 0f));

                        AObject bubble = world.GetObjectFromId("bubble main");
                        bubble.SetAnimationIndex(2);

                        this.timeElapsed = Time.Zero;
                        this.periodPhase = Time.FromSeconds(2);
                        this.moment = ResolvePhaseMoment.BUBBLE_APPEARED;
                        break;
                    case ResolvePhaseMoment.END_DIALOGUE:
                        AObject patient = world.GetObjectFromId("patient main");
                        if (this.isSuccess)
                        {
                            dialogue = world.GetObjectFromId("dialogue successAnswer") as DialogueObject;
                            patient.SetAnimationIndex(5);
                        }
                        else
                        {
                            dialogue = world.GetObjectFromId("dialogue failAnswer") as DialogueObject;
                            patient.SetAnimationIndex(4);
                        }
                        dialogue.ResetDialogue();

                        bubble = world.GetObjectFromId("bubble main");
                        bubble.SetAnimationIndex(3);

                        queueTalk = world.GetObjectFromId("queueTalk main");
                        queueTalk.SetKinematicParameters(new Vector2f(10000, 10000), new Vector2f(0, 0));

                        this.timeElapsed = Time.Zero;
                        this.periodPhase = Time.FromSeconds(2);
                        this.moment = ResolvePhaseMoment.END;
                        break;
                    case ResolvePhaseMoment.END:

                        if (this.isSuccess)
                        {
                            world.NotifyGameStateChanged(world.CurrentLevel.LevelName, new GameEvent(EventType.ENDING, "good"));
                        }
                        else
                        {
                            world.NotifyGameStateChanged(world.CurrentLevel.LevelName, new GameEvent(EventType.ENDING, "bad"));
                        }

                        this.NodeState = NodeState.NOT_ACTIVE;
                        break;
                }
            }
        }