Example #1
0
        public ThinkPhase()
        {
            this.periodPhase = Time.FromSeconds(1);

            this.timeElapsed = Time.Zero;

            this.moment = ThinkPhaseMoment.START;
        }
Example #2
0
        private void EndTimerAction(OfficeWorld world)
        {
            world.NotifyGameStateChanged(world.CurrentLevel.LevelName, new GameEvent(EventType.END_TIMER, string.Empty));

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

            dialogue.ResetDialogue();

            DialogueObject dialogueAnswer = world.GetObjectFromId("dialogue answer") as DialogueObject;

            dialogueAnswer.ResetDialogue();

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

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

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

            bubble.SetAnimationIndex(3);

            AToken timerToken = world.GetObjectFromId("timerToken main") as AToken;

            timerToken.DisplayText = string.Empty;

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

            queueDream.SetKinematicParameters(new Vector2f(1000, 1000), new Vector2f(0f, 0f));

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

            timer.SetAnimationIndex(3);

            this.timeElapsed = Time.Zero;
            this.periodPhase = Time.FromSeconds(3);
            this.moment      = ThinkPhaseMoment.END;
        }
Example #3
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();
            }
        }