Exemple #1
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();
            }
        }