예제 #1
0
        public PlayGameMenu(GameEngine engine)
        {
            this.engine = engine;

            float btnXPos = engine.GetScreenSize().Width / 2;
            float btnYPos = engine.GetScreenSize().Height / 2;

            player1Btn = new Button("player1Btn", btnXPos - 100, btnYPos - 100, 100, 100, 0,
                                    new BoundingBox(new Vector3(0, 0, 0), new Vector3(0, 0, 0)), 1, null, false, false, 0);

            player2Btn = new Button("player2Btn", btnXPos + 100, btnYPos - 100, 100, 100, 0,
                                    new BoundingBox(new Vector3(0, 0, 0), new Vector3(0, 0, 0)), 1, null, false, false, 1);

            player3Btn = new Button("player3Btn", btnXPos - 100, btnYPos + 50, 100, 100, 0,
                                    new BoundingBox(new Vector3(0, 0, 0), new Vector3(0, 0, 0)), 1, null, false, false, 2);

            player4Btn = new Button("player4Btn", btnXPos + 100, btnYPos + 50, 100, 100, 0,
                                    new BoundingBox(new Vector3(0, 0, 0), new Vector3(0, 0, 0)), 1, null, false, false, 3);

            playBtn = new Button("playBtn", btnXPos + 200, btnYPos + 200, 150, 50, 0,
                                 new BoundingBox(new Vector3(0, 0, 0), new Vector3(0, 0, 0)), 1, null, false, false, 4);

            backBtn = new Button("backBtn", btnXPos - 200, btnYPos + 200, 150, 50, 0,
                                 new BoundingBox(new Vector3(0, 0, 0), new Vector3(0, 0, 0)), 1, null, false, true, 5);

            menu = new RenderedEntity("menu", engine.GetScreenSize().Width / 2, engine.GetScreenSize().Height / 2, 600, 480, 0,
                                      new BoundingBox(), 0, null, false);
        }
예제 #2
0
 public StartMenu(GameEngine engine)
 {
     this.engine = engine;
     playBtn     = new Button("playBtn", engine.GetScreenSize().Width / 2, engine.GetScreenSize().Height / 2,
                              150, 50, 0, new BoundingBox(), 1, null, false, true, 0);
     optionsBtn = new Button("optionsBtn", engine.GetScreenSize().Width / 2, engine.GetScreenSize().Height / 2 + 100,
                             150, 50, 0, new BoundingBox(), 1, null, false, false, 1);
     exitBtn = new Button("exitBtn", engine.GetScreenSize().Width / 2, engine.GetScreenSize().Height / 2 + 200,
                          150, 50, 0, new BoundingBox(), 1, null, false, false, 2);
     menu = new RenderedEntity("menu", engine.GetScreenSize().Width / 2, engine.GetScreenSize().Height / 2,
                               600, 480, 0, new BoundingBox(), 0, null, false);
 }
예제 #3
0
        public OptionMenu(GameEngine engine)
        {
            this.engine = engine;
            float btnXPos = engine.GetScreenSize().Width / 2;
            float btnYPos = engine.GetScreenSize().Height / 2;

            backBtn = new Button("backBtn", btnXPos - 200, btnYPos + 200, 150, 50, 0,
                                 new BoundingBox(new Vector3(0, 0, 0), new Vector3(0, 0, 0)), 1, null, false, true, 2);

            menu = new RenderedEntity("menu", engine.GetScreenSize().Width / 2, engine.GetScreenSize().Height / 2, 600, 480, 0,
                                      new BoundingBox(), 0, null);

            volume = new OptionBar("masterVolume", engine.GetScreenSize().Width / 2, engine.GetScreenSize().Height / 2 - 100, 165, 24, 0,
                                   new BoundingBox(), 1, null, false, false, 10, 0, new Rectangle(0, 0, 0, 0));

            fullscreen = new CheckBox("fullscreen", engine.GetScreenSize().Width / 2, engine.GetScreenSize().Height / 2 + 0, 20, 20, 0,
                                      new BoundingBox(), 1, null, false, false, 1);
        }
예제 #4
0
        public GameMenu(GameEngine engine)
        {
            this.engine = engine;
            float btnXPos = engine.GetScreenSize().Width / 2;
            float btnYPos = engine.GetScreenSize().Height / 2;

            resumeBtn = new Button("resumeBtn", btnXPos, btnYPos - 200, 150, 50, 0,
                                   new BoundingBox(new Vector3(0, 0, 0), new Vector3(0, 0, 0)), 1, null, false, true, 0);

            saveBtn = new Button("saveBtn", btnXPos, btnYPos - 100, 150, 50, 0,
                                 new BoundingBox(new Vector3(0, 0, 0), new Vector3(0, 0, 0)), 1, null, false, false, 1);

            optionBtn = new Button("optionBtn", btnXPos, btnYPos, 150, 50, 0,
                                   new BoundingBox(new Vector3(0, 0, 0), new Vector3(0, 0, 0)), 1, null, false, false, 2);

            exitMenuBtn = new Button("exitMenuBtn", btnXPos, btnYPos + 100, 150, 50, 0,
                                     new BoundingBox(new Vector3(0, 0, 0), new Vector3(0, 0, 0)), 1, null, false, false, 3);

            exitBtn = new Button("exitBtn", btnXPos, btnYPos + 100, 150, 50, 0,
                                 new BoundingBox(new Vector3(0, 0, 0), new Vector3(0, 0, 0)), 1, null, false, false, 4);

            menu = new RenderedEntity("menu", engine.GetScreenSize().Width / 2, engine.GetScreenSize().Height / 2, 600, 480, 0,
                                      new BoundingBox(), 0, null, false);
        }
예제 #5
0
        //Defines which content should be ed for the specified entity

        /*TODO iteration3: First of all add more content to the game engine, but  it should also
         * be able to  content not only for a player but also other kinds of objects
         */
        public void OnNext(List <Texture2D> value)
        {
            for (int i = 0; i < engine.Entities.Count; i++)
            {
                if (engine.Entities [i].GetType() == typeof(Player))
                {
                    HandlePlayerContent(value, i);
                }

                else if (engine.Entities [i].GetType() == typeof(Tile))
                {
                    Tile tile = (Tile)engine.Entities [i];

                    if (tile.Texture == null)
                    {
                        Random r = new Random(int.Parse(Guid.NewGuid().ToString().Substring(0, 8),
                                                        System.Globalization.NumberStyles.HexNumber));
                        int randInt = r.Next(1, nTileTypes + 1);
                        tile.Texture = value.Find(x => x.Name.Equals("tile_" + randInt));
                    }
                    engine.Entities [i] = tile;
                }
                if (engine.Entities [i].GetType() == typeof(HealthBar))
                {
                    HealthBar healthBar = (HealthBar)engine.Entities [i];
                    if (healthBar.Texture == null)
                    {
                        engine.AddTextureOnEntity("health_Bar", healthBar.ID);
                    }
                }
                if (engine.Entities [i].GetType() == typeof(HungerBar))
                {
                    HungerBar hungerBar = (HungerBar)engine.Entities [i];
                    if (hungerBar.Texture == null)
                    {
                        engine.AddTextureOnEntity("hunger_Bar", hungerBar.ID);
                    }
                }
                if (engine.Entities[i].GetType() == typeof(Bush))
                {
                    Bush bush = (Bush)engine.Entities [i];

                    if (bush.Texture == null)
                    {
                        bush.Texture = value.Find(x => x.Name.Equals("bush_2"));
                    }
                    //engine.Entities[i] = bush;
                    if (bush.IsUsed)
                    {
                        engine.AddTextureOnEntity("bush_1", bush.ID);
                    }
                }

                if (engine.Entities[i].GetType() == typeof(Wolf))
                {
                    HandleWolfContent(value, i);
                }

                else if (engine.Entities [i].GetType() == typeof(Button))
                {
                    Button button = (Button)engine.Entities [i];
                    HandleButtonTexture(button);
                }
                else if (engine.Entities [i].GetType() == typeof(CheckBox))
                {
                    CheckBox checkBox = (CheckBox)engine.Entities [i];
                    if (checkBox.Texture == null || !checkBox.IsHighlighted)
                    {
                        if (!checkBox.IsChecked)
                        {
                            engine.AddTextureOnEntity("CheckBox", checkBox.ID);
                        }
                        else
                        {
                            engine.AddTextureOnEntity("CheckBox_C", checkBox.ID);
                        }
                    }
                    else if (checkBox.IsHighlighted)
                    {
                        if (!checkBox.IsChecked)
                        {
                            engine.AddTextureOnEntity("CheckBox_Y", checkBox.ID);
                        }
                        else
                        {
                            engine.AddTextureOnEntity("CheckBox_C_Y", checkBox.ID);
                        }
                    }
                }
                else if (engine.Entities [i].GetType() == typeof(RenderedEntity))
                {
                    RenderedEntity rendEnt = (RenderedEntity)engine.Entities [i];
                    if (rendEnt.Texture == null)
                    {
                        engine.AddTextureOnEntity("Menu", rendEnt.ID);
                    }
                }
                else if (engine.Entities [i].GetType() == typeof(OptionBar))
                {
                    OptionBar optionBar = (OptionBar)engine.Entities [i];
                    HandleOptionBar(optionBar);
                }
            }
        }