public void Enter(CutScene current_cutscene)
        {
            Game1.current_state.Exit();
            Game1.current_state = this;

            //Initialise stuff
            this.current_cutscene = current_cutscene;
            this.current_cutscene.load_action();
            time      = 0;
            prev_time = 0;
            stop_watch.Start();
            subtitle_overlay = Content.Load <Texture2D>("subtitle_overlay");
        }
Example #2
0
        public void Update(GameTime gameTime)
        {
            Controls.set_cursor();

            dialogue_options.Update(Controls.cursor.position);

            if (Controls.clicked_once() || Controls.pressed_once(Buttons.A))
            {
                CutScene next_scene = dialogue_options.get_highlighted_scene();
                if (next_scene != null)
                {
                    Game1.cutscene_state.Enter(next_scene);
                    //game_state.current_cs = next_scene;
                    //stop_watch.Start();
                    //time = 0;
                    //change_state(GameState.State.CutScene);
                }
            }
        }
Example #3
0
 public DialogueItem(string text, CutScene scene_to_play, bool visible)
 {
     this.text          = text;
     this.scene_to_play = scene_to_play;
     this.visible       = visible;
 }
Example #4
0
 public DialogueHS(Rectangle region, CutScene scene)
     : base(region, Type.dialogue)
 {
     this.scene = scene;
 }
        public void Update(GameTime gameTime)
        {
            //CutScene cs = game_state.current_cs;
            CutScene cs = current_cutscene;

            List <Cue> aso = cs.all_scene_objects;
            List <Cue> cdo = cs.currently_displayed;

            bool ending = false;

            time     += stop_watch.ElapsedMilliseconds - prev_time;
            prev_time = stop_watch.ElapsedMilliseconds;

            //1. Look for Cues that can be added to currently displayed objects
            for (int i = 0; i < aso.Count; i++)
            {
                Cue cue = aso[i];
                if (time > cue.fire_at)
                {
                    cdo.Add(cue);
                    aso.Remove(cue);

                    cdo.Sort();

                    if (cue.type == CueType.End)
                    {
                        ending = true;
                    }
                }
            }

            //2. Remove expired Cues from currently displayed objects
            for (int i = 0; i < cdo.Count; i++)
            {
                Cue cue = cdo[i];
                if (time > cue.remove_at && cue.type != CueType.Sound)
                {
                    cdo.Remove(cue);
                }
            }

            //3. Look for the current comic and update any transitions
            foreach (Cue cue in cdo)
            {
                if (cue.type == CueType.Fade)
                {
                    Fade f = (Fade)cue;
                    f.Update(time);
                }

                if (cue.type == CueType.Transition)
                {
                    Transition t          = cue as Transition;
                    float      percentage = ((float)time - (float)t.fire_at) / ((float)t.remove_at - (float)t.fire_at);
                    t.calc_trans_rect(percentage);
                }
            }

            //4. Play sounds and then remove them
            for (int i = 0; i < cdo.Count; i++)
            {
                Cue cue = cdo[i];

                if (cue.type == CueType.Sound)
                {
                    Sound s = cue as Sound;
                    Globals.soundBank.PlayCue(s.name);
                    cdo.Remove(s);
                }
            }

            //5. Check if we have reached the end of the CutScene
            if (Controls.pressed_once(Keys.Enter) || Controls.pressed_once(Buttons.B) || ending)
            {
                Globals.StopEffects();

                Game1.current_state = cs.return_state;
                Game1.chat_state.dialogue_options = cs.dialogue_options;
                //game_state.state = cs.return_state;
                //game_state.dialogue_options = cs.dialogue_options;
                cdo.Clear();
                aso.Clear();
                stop_watch.Reset();
                prev_time = 0;
            }

            //6. Skip to the next panel or the next audio cue
            if ((Controls.pressed_once(Keys.Space) || Controls.pressed_once(Buttons.A) || Controls.clicked_once()) && cs.skippable)
            {
                ViewPanel vp = next_vp();

                if (vp != null)
                {
                    Globals.StopEffects();
                    time = vp.fire_at;
                }
                else
                {
                    Sound s = next_sound();
                    if (s != null)
                    {
                        Globals.StopEffects();
                        time = s.fire_at;
                    }
                    else
                    {
                        stop_watch.Reset();
                        prev_time = 0;
                        Globals.StopEffects();

                        Game1.current_state = cs.return_state;
                        Game1.chat_state.dialogue_options = cs.dialogue_options;

                        //game_state.state = cs.return_state;
                        //game_state.dialogue_options = cs.dialogue_options;
                        cdo.Clear();
                        aso.Clear();
                    }
                }
            }
        }