Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new LeftRight Switch.
        /// </summary>
        /// <param name="_position">Position where the Switch should be</param>
        /// <param name="texturePaths">TexturePaths of the Icons that should be inside the Switch. The First Element of the Array will be displayt first</param>
        public LeftRightSwitch(Vector2 _position, String[] texturePaths)
        {
            pointer = 0;
            position = _position;
            iconsInside = new Icon[texturePaths.Length];
            Left = new Button(new Vector2(position.X, position.Y), "Textures/CharacterSelection/LeftNotSelected", "Textures/CharacterSelection/LeftSelected");
            for (int i = 0; i < texturePaths.Length; i++)
                iconsInside[i] = new Icon(new Vector2(position.X + Left.getWidth(), position.Y), texturePaths[i]);
            Left.setPosition(new Vector2(position.X, position.Y + (iconsInside[pointer].getHeight() / 2) - Left.getHeight() / 2));

            Right = new Button(new Vector2(position.X + iconsInside[0].getWidth() + Left.getWidth(), position.Y + (iconsInside[pointer].getHeight() / 2) - Left.getHeight() / 2), "Textures/CharacterSelection/RightNotSelected", "Textures/CharacterSelection/RightSelected");
        }
Ejemplo n.º 2
0
        public Won(PlayerStuff.Player.EPlayerViewportPosition playerIndex, bool won)
        {
            infoText = new Text("03", new Vector2(0, 0));
            infoText.setIndividualScale(2);
            infoText.setPosition(new Vector2(Settings.getResolutionX() / 2 - infoText.getWidth() / 2, Settings.getResolutionY() - infoText.getHeight()));
            elapsedTime = 0;

            switch (playerIndex)
            {

                case PlayerStuff.Player.EPlayerViewportPosition.fullscreen:
                    if(won)
                       {
                           infoText.setColor(Color.Black);
                         background = new Icon(new Microsoft.Xna.Framework.Vector2(0, 0), "Textures/WinScreens/youWin");
                       }
                    else
                    {
                        infoText.setColor(Color.White);
                        background = new Icon(new Microsoft.Xna.Framework.Vector2(0, 0), "Textures/WinScreens/youLose");
                    }
                    break;
                case PlayerStuff.Player.EPlayerViewportPosition.left:
                    infoText.setColor(Color.White);
                    background = new Icon(new Microsoft.Xna.Framework.Vector2(0, 0), "Textures/WinScreens/player1Win");
                    break;
                case PlayerStuff.Player.EPlayerViewportPosition.right:
                    infoText.setColor(Color.White);
                    background = new Icon(new Microsoft.Xna.Framework.Vector2(0, 0), "Textures/WinScreens/player2Win");
                    break;
                case PlayerStuff.Player.EPlayerViewportPosition.topLeft:
                    infoText.setColor(Color.White);
                    background = new Icon(new Microsoft.Xna.Framework.Vector2(0, 0), "Textures/WinScreens/player1Win");
                    break;
                case PlayerStuff.Player.EPlayerViewportPosition.botLeft:
                    infoText.setColor(Color.White);
                    background = new Icon(new Microsoft.Xna.Framework.Vector2(0, 0), "Textures/WinScreens/player2Win");
                    break;
                case PlayerStuff.Player.EPlayerViewportPosition.topRight:
                    infoText.setColor(Color.White);
                    background = new Icon(new Microsoft.Xna.Framework.Vector2(0, 0), "Textures/WinScreens/player3Win");
                    break;
                case PlayerStuff.Player.EPlayerViewportPosition.botRight:
                    infoText.setColor(Color.White);
                    background = new Icon(new Microsoft.Xna.Framework.Vector2(0, 0), "Textures/WinScreens/player4Win");
                    break;
            }
        }
Ejemplo n.º 3
0
        public Pause(Player.EPlayerControlls _controlls)
        {
            controlls = _controlls;
            count = 0;
            isPressed = true;

            Vector2 position = new Vector2(0, 0);
            gresScreen = new Icon( position, "Textures/Pause/greyScreen");

            float distY = 100 * Settings.getInterfaceScale();
            resume = new Button(position, "Textures/Pause/resumeNot", "Textures/Pause/resumeSelected");
            exit = new Button(position, "Textures/Pause/exitNot", "Textures/Pause/exitSelected");

            position = new Vector2(Settings.getResolutionX() / 2 - resume.getWidth()/2, Settings.getResolutionY() / 2 - resume.getHeight() - distY);
            resume.setPosition(position);
            position = new Vector2(Settings.getResolutionX() / 2 - exit.getWidth() / 2, Settings.getResolutionY() / 2 + distY);
            exit.setPosition(position);
        }
Ejemplo n.º 4
0
        public override void loadContent()
        {
            if (Game1.getGraphics() != null)
            {
                distY *= Settings.getInterfaceScale();
                offset *= Settings.getInterfaceScale();
                gameModeIcon = new Icon(gameModeIconPosition, "Textures/CharacterSelection/GameMode");
                rushHour = new Icon(new Vector2(1200 * Settings.getInterfaceScale(), 45 * Settings.getInterfaceScale()), "Textures/CharacterSelection/RushHourExplanation");
                needForIngredients = new Icon(new Vector2(1200 * Settings.getInterfaceScale(), 45 * Settings.getInterfaceScale()), "Textures/CharacterSelection/NeedForIngredientsExplanation");
                //spaceNote = new Icon(new Vector2(1090 * Settings.getInterfaceScale(), 900 * Settings.getInterfaceScale()), "Textures/CharacterSelection/SpaceHinweis");
                escapeNote = new Icon(new Vector2(1080 * Settings.getInterfaceScale(), 950 * Settings.getInterfaceScale()), "Textures/CharacterSelection/escapeNote");
                keyboard1 = new Icon(new Vector2(1005 * Settings.getInterfaceScale(), 300 * Settings.getInterfaceScale()), "Textures/CharacterSelection/Keyboard1");
                keyboard2 = new Icon(new Vector2(1005 * Settings.getInterfaceScale(), 510 * Settings.getInterfaceScale()), "Textures/CharacterSelection/Keyboard2");
                gamepad = new Icon(new Vector2(1005 * Settings.getInterfaceScale(), 725 * Settings.getInterfaceScale()), "Textures/CharacterSelection/Gamepad1");
                player1Icon = new Button(new Vector2(20, (gameModeIcon.getPosition().Y + gameModeIcon.getHeight()) + distY), "Textures/CharacterSelection/Player1NotSelected", "Textures/CharacterSelection/Player1Selected");
                player2Icon = new Button(new Vector2(20, (player1Icon.getPosition().Y + player1Icon.getHeight()) + distY), "Textures/CharacterSelection/Player2NotSelected", "Textures/CharacterSelection/Player2Selected");
                player3Icon = new Button(new Vector2(20, (player2Icon.getPosition().Y + player2Icon.getHeight()) + distY), "Textures/CharacterSelection/Player3NotSelected", "Textures/CharacterSelection/Player3Selected");
                player4Icon = new Button(new Vector2(20, (player3Icon.getPosition().Y + player3Icon.getHeight()) + distY), "Textures/CharacterSelection/Player4NotSelected", "Textures/CharacterSelection/Player4Selected");

                String[] gameModes = {"Textures/CharacterSelection/NeedForIngredientsNotSelected", "Textures/CharacterSelection/RushHourNotSelected"};//GameModeIdeen: RushHour, Need for Ingrediance, SpeedRun, NeedForItems
                //0 = test;
                //1 = rushHour;
                GameModeSelected = new LeftRightSwitch(new Vector2(gameModeIconPosition.X + gameModeIcon.getWidth() + offset, gameModeIconPosition.Y), gameModes);
                GameModeSelected.setSelected();
                String[] playerControlls = { "Textures/CharacterSelection/Join",
                                               "Textures/CharacterSelection/Keyboard","Textures/CharacterSelection/KeyboardNumPad",
                                               "Textures/CharacterSelection/GamepadNr1", "Textures/CharacterSelection/GamepadNr2", "Textures/CharacterSelection/GamepadNr3", "Textures/CharacterSelection/GamepadNr4"  };
                // 1 := join
                // 2 := Keyboard
                // 3 := Gamepad
                player1ControllsLRS = new LeftRightSwitch(new Vector2(player1Icon.getPosition().X + player1Icon.getWidth() + offset, player1Icon.getPosition().Y), playerControlls);
                player2ControllsLRS = new LeftRightSwitch(new Vector2(player2Icon.getPosition().X + player2Icon.getWidth() + offset, player2Icon.getPosition().Y), playerControlls);
                player3ControllsLRS = new LeftRightSwitch(new Vector2(player3Icon.getPosition().X + player3Icon.getWidth() + offset, player3Icon.getPosition().Y), playerControlls);
                player4ControllsLRS = new LeftRightSwitch(new Vector2(player4Icon.getPosition().X + player4Icon.getWidth() + offset, player4Icon.getPosition().Y), playerControlls);

                infoText = new Text("Game starts in 03!", new Vector2(0, 0));
                infoText.setIndividualScale(3);
                infoText.setPosition(new Vector2(Settings.getResolutionX() / 2 - infoText.getWidth() / 2, Settings.getResolutionY() / 2 - infoText.getHeight() / 2));
                infoText.setColor(Color.White);
            }
        }
Ejemplo n.º 5
0
        public override void loadContent()
        {
            if (Game1.getGraphics() != null)
            {
                distY *= Settings.getInterfaceScale();
                offset *= Settings.getInterfaceScale();
                optionsTitel = new Icon(optionsTitelPosition * Settings.getInterfaceScale(), "Textures/option/optionsTitel");
                fullscreenButton = new Button(new Vector2(560 * Settings.getInterfaceScale(), (optionsTitel.getPosition().Y + optionsTitel.getHeight()) + distY),  "Textures/option/Fullscreen", "Textures/option/FullscreenSelected");
                resolutionButton = new Button(new Vector2(560 * Settings.getInterfaceScale(), (fullscreenButton.getPosition().Y + fullscreenButton.getHeight()) + distY),"Textures/option/Resolution", "Textures/option/ResolutionSelected");
                volumeButton = new Button(new Vector2(560 * Settings.getInterfaceScale(), (resolutionButton.getPosition().Y + resolutionButton.getHeight()) + distY), "Textures/option/Volume", "Textures/option/VolumeSelected");
                enterEscNote = new Icon(new Vector2(660 * Settings.getInterfaceScale(), (volumeButton.getPosition().Y + volumeButton.getHeight()) + distY), "Textures/EnterEscNote");
                String[] resolutions = { "Textures/option/720p", "Textures/option/1366p", "Textures/option/1080p" };//, "Textures/option/1024p"
                String[] fullscreenmode = { "Textures/option/offButton", "Textures/option/onButton" };
                String[] volumtmodes = { "Textures/option/100Prozent", "Textures/option/90Prozent", "Textures/option/80Prozent", "Textures/option/70Prozent", "Textures/option/60Prozent", "Textures/option/50Prozent", "Textures/option/40Prozent", "Textures/option/30Prozent", "Textures/option/20Prozent", "Textures/option/10Prozent", "Textures/option/offButton" };

                resolutionLR = new LeftRightSwitch(new Vector2(resolutionButton.getPosition().X + resolutionButton.getWidth() + offset, resolutionButton.getPosition().Y), resolutions);
                fullscreenLR = new LeftRightSwitch(new Vector2(fullscreenButton.getPosition().X + fullscreenButton.getWidth() + offset, fullscreenButton.getPosition().Y), fullscreenmode);
                volumeLR = new LeftRightSwitch(new Vector2(volumeButton.getPosition().X + volumeButton.getWidth() + offset, volumeButton.getPosition().Y), volumtmodes);

                //always show the actual settings selected first
                if (Settings.isFullscreen())
                    fullscreenLR.switchLeft();
                if (Settings.getResolutionX() == 1366)
                    resolutionLR.switchRight();
                if (Settings.getResolutionX() == 1920)
                    resolutionLR.switchLeft();
                int h = 10 - (int)(Settings.getSoundVolume() * 10);
                while (volumeLR.getDisplayedIndex() != h)
                    volumeLR.switchLeft();

                //initially set the buttons
                volumeButton.setNotSelected();
                volumeLR.setNotSelected();
                resolutionButton.setNotSelected();
                resolutionLR.setNotSelected();
                fullscreenButton.setSelected();
                fullscreenLR.setSelected();

            }
        }
Ejemplo n.º 6
0
        public override void loadContent()
        {
            if (Game1.getGraphics() != null)
            {
                GraphicsDevice graphicsDevice = Game1.getGraphics().GraphicsDevice;

                float distY = 105 * Settings.getInterfaceScale();
                float distX = 400 * Settings.getInterfaceScale();//float distX = 822.5f* Settings.getInterfaceScale();
                start = new Button(new Vector2(distX, distY), "Textures/mainmenu/startGame", "Textures/mainmenu/startGameIsPressed");
                help = new Button(new Vector2(distX, start.getPosition().Y + start.getHeight() + distY), "Textures/mainmenu/help", "Textures/mainmenu/helpIsPressed");
                option = new Button(new Vector2(distX, help.getPosition().Y + help.getHeight() + distY), "Textures/mainmenu/options", "Textures/mainmenu/optionsIsPressed");
                credits = new Button(new Vector2(distX, option.getPosition().Y + option.getHeight() + distY), "Textures/mainmenu/credits", "Textures/mainmenu/creditsIsPressed");
                exit = new Button(new Vector2(distX, credits.getPosition().Y + credits.getHeight() + distY), "Textures/mainmenu/exit", "Textures/mainmenu/exitIsPressed");

                titel = new Icon(new Vector2(0.5f* start.getPosition().X + start.getWidth() + distX, start.getPosition().Y + start.getHeight() + distY), "Textures/mainmenu/titel");

                count = 0;
                start.setSelected();
                help.setNotSelected();
                option.setNotSelected();
                credits.setNotSelected();
                exit.setNotSelected();
            }
        }
Ejemplo n.º 7
0
        public void setFinalPlayer(Vector3 spawnPosition, EPlayerViewportPosition viewportPosition)
        {
            playerViewportPosition = viewportPosition;
            this.setViewport();

            itemsCollected = new List<Item>();
            keyboard = Keyboard.GetState();
            aspectRatio = viewport.AspectRatio;
            // params : position, forward,up, matrix out

            //werte sollten später für jeden Spieler einzeln angepasst werden

            playerIcon = new Icon(new Vector2(0, 0), "Textures/playerIcon");

            position = spawnPosition;
            lookAt = new Vector3(Settings.getMapSizeX() / 2, (float)0.22, Settings.getMapSizeZ() / 2);//sollte neu berechnet werden //immer zur mitte der Map?
            upDirection = new Vector3(0, 1, 0);

            //draufsicht
            /* position = new Vector3(5, -40, 5);
             lookAt = new Vector3(0, 1, 1);
             upDirection = new Vector3(0, 0, 1);*/

            GamePadState currentState = GamePad.GetState(PlayerIndex.One); //do we need this and why? :O

            //camera = Matrix.CreateLookAt(new Vector3(position.X - Settings.getResolutionX() / 2, position.Y, position.Z), lookAt, upDirection);
            Vector3 h = (lookAt - position);
            h.Normalize();
            cameraPosition = position - (h) * cameraOffset;
            cameraPosition.Y += camerOffsetY;
            camera = Matrix.CreateWorld(cameraPosition, lookAt, upDirection);
            projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspectRatio, 0.1f, 1000.0f);
            world = Matrix.Identity;
            direction = lookAt - position;
            ortoDirection = Vector3.Cross(direction, upDirection);
            effect.LightingEnabled = true;

            movementRotationX = 0;
            movementRotationZ = 0;

            isBouncing = false;
            bouncingTime = 3;
            bouncingTimeLeft = 0;

            skybox = new Skybox(Game1.getContent().Load<Texture2D>("Models/SkyboxTexture"), Game1.getContent().Load<Model>("Models/skybox"));
        }
Ejemplo n.º 8
0
 public override void loadContent()
 {
     credits = new Icon(new Vector2(0 * Settings.getInterfaceScale(), 0 * Settings.getInterfaceScale()), "Textures/credits/CreditsFilled");
 }
Ejemplo n.º 9
0
 public override void loadContent()
 {
     xboxControl = new Icon(new Vector2(120 * Settings.getInterfaceScale(), 200 * Settings.getInterfaceScale()), "Textures/help/xboxControl");
        numpadControl = new Icon(new Vector2(1320 * Settings.getInterfaceScale(), 200 * Settings.getInterfaceScale()), "Textures/help/numpadControl");
        wasdControl = new Icon(new Vector2(720 * Settings.getInterfaceScale(), 200 * Settings.getInterfaceScale()), "Textures/help/wasdControl");
 }
Ejemplo n.º 10
0
 /// <summary>
 /// randomly spawns different Items in the ItemList
 /// </summary>
 public void spawnRandomItems()
 {
     for (int i = 0; i < this.itemList.Count(); i++)
     {
         redCrossList[i] = new Icon(new Vector2(0, 0), "Textures/redCross");
         Item item = itemSpawner.generateRandomItem();
         itemList[i] = item;
         for(int j = 0; j < i; j++){
             if (itemList[j].itemIndex == itemList[i].itemIndex)//itemList[i].itemIndex == itemList[j].itemIndex
             {
                 i--;
                 break;
             }
         }
         itemCollected[i] = false;
     }
 }