Exemple #1
0
        public void Update(GameTime gameTime)
        {
            //cursor.position.X = mouseState.X;
            //cursor.position.Y = mouseState.Y;
            Controls.set_cursor();

            //This is totally cray cray. We change the icon, if we hover over a hotspot.
            foreach (HotSpot hs in Globals.current_room.hotspots)
            {
                if (hs.region.Contains(Controls.cursor.position.X, Controls.cursor.position.Y) && hs.active)
                {
                    if (hs.type == HotSpot.Type.room_change)
                    {
                        Controls.cursor.type = Cursor.Type.go;
                        break;
                    }
                    else if (hs.type == HotSpot.Type.dialogue)
                    {
                        Controls.cursor.type = Cursor.Type.talk;
                        break;
                    }
                    else if (hs.type == HotSpot.Type.exit)
                    {
                        Controls.cursor.type = Cursor.Type.exit;
                        break;
                    }
                }

                if (Controls.cursor.type != Cursor.Type.item)
                {
                    Controls.cursor.type = Cursor.Type.grab;
                }
            }

            if (Controls.pressed_once(Keys.I) || Controls.pressed_once(Buttons.Y))
            {
                Game1.inventory_state.Enter();
                //game_state.state = GameState.State.Inventory;

                //cursor.type = Cursor.Type.grab; //Should be in InventoryState.Enter()
            }

            //Click happened
            if (Controls.clicked_once() || Controls.pressed_once(Buttons.A))
            {
                //Look through all hot spots in the current room
                foreach (HotSpot hs in Globals.current_room.hotspots)
                {
                    if (Controls.cursor.position.Intersects(hs.region) && hs.active)
                    {
                        if (hs.type == HotSpot.Type.room_change && Controls.cursor.type == Cursor.Type.go)
                        {
                            //Clicked on a room change hotspot. Better do something SIC
                            RoomChangeHS rcHS = (RoomChangeHS)hs;
                            Globals.current_room = rcHS.leads_to;
                            break;
                        }
                        else if (hs.type == HotSpot.Type.dialogue && Controls.cursor.type == Cursor.Type.talk)
                        {
                            //Clicked on a dialogue hot spot. Better play a CutScene
                            DialogueHS dialogueHS = (DialogueHS)hs;

                            Game1.cutscene_state.Enter(dialogueHS.scene);
                            //game_state.current_cs = dialogueHS.scene;
                            //time = 0;
                            //stop_watch.Start();
                            //change_state(GameState.State.CutScene);
                        }
                        else if (hs.type == HotSpot.Type.exit && Controls.cursor.type == Cursor.Type.exit)
                        {
                            //Clicked on a room change hotspot. Better do something SIC
                            ExitHS exitHS = (ExitHS)hs;
                            Globals.current_room = exitHS.leads_to;
                            break;
                        }
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            fonts = new Fonts(Content);
            Globals.title_safe_rect = GetTitleSafeArea(0.8f);

            spriteBatch = new SpriteBatch(GraphicsDevice);

            //THE INDEPENDANT STATES OF GRODG2
            menu_state         = new MenuState(spriteBatch, this);
            about_state        = new AboutState(Content, spriteBatch);
            cutscene_state     = new CutSceneState(spriteBatch, Content);
            gameplay_state     = new GamePlayState(spriteBatch);
            chat_state         = new ChatState(spriteBatch);
            inventory_state    = new InventoryState(Content, spriteBatch, Globals.title_safe_rect);
            start_prompt_state = new StartPromptState(spriteBatch);

            current_state = start_prompt_state;

            //Initialise cutscenes
            InitialiseDialogueOptions();
            InitialiseCutScenes();
            AddDialogueItems();

            webaddress_pos.X = Globals.title_safe_rect.Right - Fonts.SubtitleFont.MeasureString(webaddress).X;
            webaddress_pos.Y = Globals.title_safe_rect.Top;

            Globals.current_room = cell;

            collar_poppa_room.characters.Add(collar_poppa);
            collar_poppa_room.characters.Add(black_betty);

            cell.hotspots.Add(new RoomChangeHS(new Rectangle(527, 220, 205, 347), hallway));

            hallway.hotspots.Add(new RoomChangeHS(new Rectangle(958, 246, 232, 447), yard));
            hallway.hotspots.Add(new RoomChangeHS(new Rectangle(132, 310, 144, 318), cell));

            hallway.characters.Add(sweepy);
            hallway.hotspots.Add(new DialogueHS(new Rectangle(492, 22, 191, 220), sweepy_hello));

            yard.hotspots.Add(new RoomChangeHS(new Rectangle(213, 271, 57, 215), toilet));
            yard.hotspots.Add(new RoomChangeHS(new Rectangle(879, 293, 71, 215), laundry));
            yard.hotspots.Add(new RoomChangeHS(new Rectangle(990, 274, 119, 394), library));
            yard.characters.Add(red_square);
            yard.hotspots.Add(new DialogueHS(new Rectangle(507, 407, 208, 244), collar_hello));
            yard.hotspots.Add(new ExitHS(hallway));

            professor_hs        = new DialogueHS(new Rectangle(513, 32, 272, 355), prof_hello);
            professor_hs.active = false;
            laundry.hotspots.Add(professor_hs);
            laundry.hotspots.Add(new ExitHS(yard));
            laundry.hotspots.Add(new RoomChangeHS(new Rectangle(0, 0, 404, 240), ballroom));

            mc_hummus_hs = new DialogueHS(new Rectangle(389, 17, 276, 335), mc_bad_romance);
            toilet.hotspots.Add(new ExitHS(yard));
            toilet.characters.Add(mc_hummus);
            toilet.hotspots.Add(mc_hummus_hs);

            library.hotspots.Add(new ExitHS(yard));
            library.hotspots.Add(new DialogueHS(new Rectangle(473, 14, 242, 276), bs_hello));
            library.characters.Add(ben_seib);

            ballroom.hotspots.Add(new ExitHS(laundry));
        }