Пример #1
0
        public int Update(float deltaTime, ManageStars.Rating rating, int curIndex, List <Tutorial> tutorials)
        {
            if (finished)
            {
                endAnimation.UpdateFrame(deltaTime);
                endText.Update(deltaTime);
                if (KeyboardInputManager.Downward(Keyboard.Key.Space))
                {
                    mapStatus = 1;
                }
            }
            else
            {
                background          = new Sprite(AssetManager.backgroundTextures[0]);
                background.Position = new Vector2f(0, 0);
                getBackground(curIndex);
                mapStatus   = 0;
                playerScore = player.scoreCounter;
                map.Update(deltaTime, player.keyCounter);
                player.Update(deltaTime, map);
                itemList.Update(map, player, deltaTime);
                trapHandler.Update(map, player, deltaTime);
                levelution.Update(player, map, deltaTime);
                transporterHandler.Update(player, deltaTime);
                checkTutorialNeed(rating, curIndex, tutorials);
                if (currentTutorial != null)
                {
                    currentTutorial.Update(deltaTime);
                }
                if (KeyboardInputManager.Upward(Keyboard.Key.T))
                {
                    return(3);
                }
                if (KeyboardInputManager.IsPressed(Keyboard.Key.LShift) && KeyboardInputManager.IsPressed(Keyboard.Key.LControl) && KeyboardInputManager.Upward(Keyboard.Key.Y))
                {
                    mapStatus = 1;
                }
                if (map.CellIsGoal(player.mapPosition) && player.keyCounter >= keysToUnlock)
                {
                    endSprite          = new Sprite(AssetManager.GetTexture(AssetManager.TextureName.LevelInfo));
                    endSprite.Position = new Vector2f(450, 220);
                    GraphicHelper.SetAlpha(200, endSprite);
                    SetEndMedal();
                    endMedal.Position     = endSprite.Position + new Vector2f(150, 100);
                    endAnimation          = new AnimatedSprite(AssetManager.GetTexture(AssetManager.TextureName.SpaceBar), 0.2f, 3);
                    endAnimation.Position = (Vector2)endSprite.Position + new Vector2(125, 200);
                    endText = new SuperText("Congratulations", FontLoader.Instance.LoadFont("Assets/Fonts/fixedsys.ttf"), 0.1f);
                    MusicManager.PlaySound(AssetManager.SoundName.Winning);
                    endText.Position      = (Vector2)endSprite.Position + new Vector2(20, 25);
                    endText.CharacterSize = 40;

                    finished = true;
                    addScoreFromBots();
                    CheckLevel();
                    Logger.Instance.Write("\n" + "Rating: " + playerScore + "\n" + "Bronze: " + ratingNumbers[0] + "\n" + "Silber: " + ratingNumbers[1] + "\n" + "Gold: " + ratingNumbers[2] + "\n" + "Sie haben " + CheckLevel() + " erreicht", Logger.level.Info);
                }
                if (KeyboardInputManager.Upward(Keyboard.Key.Back))
                {
                    MusicManager.StopSound();
                    foreach (Tutorial tut in tutorials)
                    {
                        if (tut.index == curIndex)
                        {
                            tut.shown = false;
                        }
                    }
                    mapStatus = 2;
                }
                guiLevelNumber.DisplayedString = "" + (curIndex + 1);
            }
            return(mapStatus);
        }
Пример #2
0
 public void CreateBot()
 {
     MusicManager.PlaySound(AssetManager.SoundName.CreateBot);
 }
Пример #3
0
        public void Initialisation()
        {
            MusicManager.PlayMusic(AssetManager.MusicName.MainMenu);
            stopwatch = new Stopwatch();
            stopwatch.Start();
            stopwatch1 = new Stopwatch();
            stopwatch1.Start();
            funactivJoh      = false;
            funacitvBenni    = false;
            font             = FontLoader.Instance.LoadFont("Assets/Fonts/fixedsys.ttf");
            sexyFont         = FontLoader.Instance.LoadFont("Assets/Fonts/pixelhole.ttf");
            MainTitleColor   = new Color(0, 2, 42);
            ProfileNameColor = new Color(125, 253, 108);
            MenuTextColor    = new Color(114, 217, 100);

            buttonList = new List <Button>();
            buttonList.Add(new Button(new Vector2f(575, 275), new Vector2i(0, 0), AssetManager.GetTexture(AssetManager.TextureName.ProfileButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileButtonGlow)));
            buttonList.Add(new Button(new Vector2f(575, 395), new Vector2i(0, 1), AssetManager.GetTexture(AssetManager.TextureName.ProfileButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileButtonGlow)));
            buttonList.Add(new Button(new Vector2f(575, 515), new Vector2i(0, 2), AssetManager.GetTexture(AssetManager.TextureName.ProfileButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileButtonGlow)));
            buttonList.Add(new Button(new Vector2f(1000, 275), new Vector2i(1, 0), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButtonGlow), AssetManager.GetTexture(AssetManager.TextureName.IconDelete)));
            buttonList.Add(new Button(new Vector2f(1000, 395), new Vector2i(1, 1), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButtonGlow), AssetManager.GetTexture(AssetManager.TextureName.IconDelete)));
            buttonList.Add(new Button(new Vector2f(1000, 515), new Vector2i(1, 2), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButtonGlow), AssetManager.GetTexture(AssetManager.TextureName.IconDelete)));
            buttonList.Add(new Button(new Vector2f(750, 645), new Vector2i(0, 3), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButtonGlow), AssetManager.GetTexture(AssetManager.TextureName.IconOptions)));
            buttonList.Add(new Button(new Vector2f(880, 645), new Vector2i(1, 3), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButtonGlow), AssetManager.GetTexture(AssetManager.TextureName.IconCredits)));
            buttonList.Add(new Button(new Vector2f(1000, 645), new Vector2i(2, 3), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButtonGlow), AssetManager.GetTexture(AssetManager.TextureName.IconExit)));

            gameTitle                = "RAMification!";
            currentTitleString       = "";
            currentlyAppendedLetters = "012";
            currentDeltaSum          = 0;

            // Witze hahahahhahaha witzig f****t....stfu das ist witzig..ne ist es nicht...ohh mr. Ernst! :/
            funBenni               = new Text("Benni heisst Online: KleinerHoden, hihi", font);
            funBenni.Position      = new Vector2f(800, 250);
            funBenni.CharacterSize = 30;
            funBenni.Color         = Color.Red;
            funBenni.Rotation      = 45;

            //Initializiere alle Texte
            gameName               = new SuperText("", sexyFont, 0.1f);
            gameName.Position      = new Vector2f(55, -65);
            gameName.CharacterSize = 240;
            gameName.Color         = MainTitleColor;

            profileOneText               = new SuperText(profiles.getProfileName(MemoryMaze.profiles.one), font, 0.15f);
            profileOneText.Position      = new Vector2f(240, 250);
            profileOneText.CharacterSize = 58;

            profileOnePercentage               = new SuperText("", font, 0.15f);
            profileOnePercentage.Position      = new Vector2f(775, 250);
            profileOnePercentage.CharacterSize = 58;

            profileTwoText               = new SuperText(profiles.getProfileName(MemoryMaze.profiles.two), font, 0.15f);
            profileTwoText.Position      = new Vector2f(240, 370);
            profileTwoText.CharacterSize = 58;

            profileTwoPercentage               = new SuperText("", font, 0.15f);
            profileTwoPercentage.Position      = new Vector2f(775, 370);
            profileTwoPercentage.CharacterSize = 58;

            profileThreeText               = new SuperText(profiles.getProfileName(MemoryMaze.profiles.three), font, 0.15f);
            profileThreeText.Position      = new Vector2f(240, 490);
            profileThreeText.CharacterSize = 58;

            ProfileThreePercentage               = new SuperText("", font, 0.15f);
            ProfileThreePercentage.Position      = new Vector2f(775, 490);
            ProfileThreePercentage.CharacterSize = 58;

            superTextList = new List <SuperText> {
                profileOneText, profileTwoText, profileThreeText, profileOnePercentage, profileTwoPercentage, ProfileThreePercentage
            };

            currentScreenPosition = new Vector2i(0, 0);

            UpdateProfilePercentage();
        }
Пример #4
0
        public GameState Update(RenderWindow win, float deltaTime)
        {
            gameName.Update(deltaTime);
            foreach (Button b in buttonList)
            {
                b.Update(deltaTime, win, currentScreenPosition);
            }
            UpdateButtonAlphas();
            if (stopwatch1.ElapsedMilliseconds > 200)
            {
                int index = -1;
                debugRect.Position = new Vector2f(-1000, -1000);                    // moves this out of the picture...
                if (settingNewProfile)
                {
                    List <char> charList = KeyboardInputManager.getCharInput();
                    if (newProfileName && KeyboardInputManager.getCharInput().Count > 0)
                    {
                        currentInput   = "";
                        newProfileName = false;
                    }
                    foreach (char c in charList)
                    {
                        if (currentInput.Length <= 16)
                        {
                            currentInput += c;
                        }
                    }
                    if (KeyboardInputManager.Downward(Keyboard.Key.Back))
                    {
                        if (currentInput != "")
                        {
                            currentInput = currentInput.Remove(currentInput.Length - 1);
                        }
                    }
                    UpdateSelectedProfileText(currentInput, deltaTime);
                    if ((KeyboardInputManager.IsPressed(Keyboard.Key.Escape) || Mouse.IsButtonPressed(Mouse.Button.Left)) && settingNewProfile)
                    {
                        settingNewProfile = false;
                        stopwatch.Restart();
                        UpdateActiveProfileText();
                        return(GameState.MainMenu);
                    }
                    if (KeyboardInputManager.Downward(Keyboard.Key.Return))
                    {
                        if (currentInput != "" && currentInput != "[Enter Name]" && profiles.GetProfileNames().Contains(currentInput) == false)
                        {
                            profiles.setProfile(currentInput, ProfileConstants.activeProfile);
                            settingNewProfile = false;
                            UpdateActiveProfileText();
                            return(GameState.LoadLevelState);
                        }
                        else
                        {
                            Logger.Instance.Write("ProfileName cannot be empty", Logger.level.Info);
                        }
                    }
                }
                else if (KeyboardInputManager.Downward(Keyboard.Key.Up) || KeyboardInputManager.Downward(Keyboard.Key.Down) || KeyboardInputManager.Downward(Keyboard.Key.Right) || KeyboardInputManager.Downward(Keyboard.Key.Left))
                {
                    bool soundactiv = false;
                    if (KeyboardInputManager.Downward(Keyboard.Key.Up) && currentScreenPosition.Y > 0)
                    {
                        soundactiv = true;
                        currentScreenPosition.Y -= 1;
                        if (currentScreenPosition.X == 2)
                        {
                            currentScreenPosition.X = 1;
                        }
                        else if (currentScreenPosition.X == 1 && currentScreenPosition.Y == 2)
                        {
                            currentScreenPosition.X = 0;
                        }
                    }
                    if (KeyboardInputManager.Downward(Keyboard.Key.Down) && currentScreenPosition.Y < 3)
                    {
                        soundactiv = true;
                        currentScreenPosition.Y += 1;
                        if (currentScreenPosition.Y == 3 && currentScreenPosition.X == 1)
                        {
                            currentScreenPosition.X = 2;
                        }
                    }
                    if (KeyboardInputManager.Downward(Keyboard.Key.Right) && currentScreenPosition.X < 1)
                    {
                        soundactiv = true;
                        currentScreenPosition.X += 1;
                    }
                    else if (KeyboardInputManager.Downward(Keyboard.Key.Right) && currentScreenPosition.X < 3 && currentScreenPosition.Y == 3)
                    {
                        soundactiv = true;
                        currentScreenPosition.X = 2;
                    }
                    if (KeyboardInputManager.Downward(Keyboard.Key.Left) && currentScreenPosition.X > 0)
                    {
                        soundactiv = true;
                        currentScreenPosition.X -= 1;
                    }

                    if (soundactiv)
                    {
                        MusicManager.PlaySound(AssetManager.SoundName.MenueClick);
                    }
                    else
                    {
                        MusicManager.PlaySound(AssetManager.SoundName.Wall);
                    }
                }
                else if (KeyboardInputManager.Downward(Keyboard.Key.Return))                       //Wurde die LinkeMaustaste gedrückt?
                {
                    //Console.WriteLine("Der Index in der SwitchAnweisung: " + index);
                    switch (IndexFromScreenPos())                                   //Bin mit der Maus über den Index: SwitchCaseWeg
                    {                                                               //bearbeitet das aktuelle TextFeld
                    //start
                    case 0:
                        ProfileConstants.activeProfile = MemoryMaze.profiles.one;
                        if (profiles.ProfileExists(MemoryMaze.profiles.one))
                        {
                            return(GameState.LoadLevelState);
                        }
                        else
                        {
                            currentInput      = "[Enter Name]";
                            settingNewProfile = true;
                            newProfileName    = true;
                            return(GameState.MainMenu);
                        }

                    case 3:
                        profiles.deleteProfile(MemoryMaze.profiles.one);
                        UpdateProfilePercentage();
                        break;

                    case 1:
                        ProfileConstants.activeProfile = MemoryMaze.profiles.two;
                        if (profiles.ProfileExists(MemoryMaze.profiles.two))
                        {
                            return(GameState.LoadLevelState);
                        }
                        else
                        {
                            currentInput      = "[Enter Name]";
                            settingNewProfile = true;
                            newProfileName    = true;
                            return(GameState.MainMenu);
                        }

                    case 4:
                        profiles.deleteProfile(MemoryMaze.profiles.two);
                        UpdateProfilePercentage();
                        break;

                    case 2:
                        ProfileConstants.activeProfile = MemoryMaze.profiles.three;
                        if (profiles.ProfileExists(MemoryMaze.profiles.three))
                        {
                            return(GameState.LoadLevelState);
                        }
                        else
                        {
                            currentInput      = "[Enter Name]";
                            settingNewProfile = true;
                            newProfileName    = true;
                            return(GameState.MainMenu);
                        }

                    case 5:
                        profiles.deleteProfile(MemoryMaze.profiles.three);
                        UpdateProfilePercentage();
                        break;

                    case 6: return(GameState.Tutorial);

                    case 7: return(GameState.Credits);

                    case 8:
                        profiles.saveManageProfiles();
                        return(GameState.None);

                    case 9:
                        funactivJoh = true; stopwatch.Restart();
                        break;

                    default: break;
                    }
                }
            }
            if (!settingNewProfile)
            {
                UpdateAllProfilesTexts();
            }
            UpdateMainTitle(deltaTime);

            foreach (SuperText s in superTextList)
            {
                s.Update(deltaTime);
            }
            return(GameState.MainMenu);
        }
Пример #5
0
        public GameState Update(RenderWindow win, float deltaTime)
        {
            int index = -1;

            lastScreen.Update(deltaTime);
            nextScreen.Update(deltaTime);
            foreach (LevelSelectButton l in mainButtonList)
            {
                l.Update(deltaTime, win, currentScreenPosition);
            }
            SetCurrentLevelInfo();
            levelInfo.Update(deltaTime, currentScreenPosition);
            leftButton.Update(deltaTime, win, currentScreenPosition);
            rightButton.Update(deltaTime, win, currentScreenPosition);
            if (stopwatch.ElapsedMilliseconds > 500)
            {
                if (Keyboard.IsKeyPressed(Keyboard.Key.Escape))
                {
                    stars.lastSelectedLevel = currentLevel;
                    stars.saveManageStars(profiles.getActiveProfileName());
                    return(GameState.MainMenu);
                }
                if (sliding)
                {
                    SlideMap(deltaTime);
                    return(GameState.LoadLevelState);
                }
                bool soundactiv = false;
                if (KeyboardInputManager.Downward(Keyboard.Key.Up) || KeyboardInputManager.Downward(Keyboard.Key.Down))
                {
                    int bottomLength = 1;
                    if (KeyboardInputManager.Downward(Keyboard.Key.Up) && currentScreenPosition.Y != 0)
                    {
                        soundactiv = true;
                        currentScreenPosition.Y = 0;
                        currentScreenPosition.X = GetPositionOnCurrentLevelScreen();
                    }
                    if (KeyboardInputManager.Downward(Keyboard.Key.Down) && currentScreenPosition.Y != 1)
                    {
                        soundactiv = true;
                        currentScreenPosition.Y = 1;
                        float help = (float)currentScreenPosition.X * (float)bottomLength / (float)(mainButtonList.Count - 1);
                        currentScreenPosition.X = (int)Math.Round(help);
                    }
                }

                if ((KeyboardInputManager.Downward(Keyboard.Key.Left) || KeyboardInputManager.Downward(Keyboard.Key.Right)) & currentScreenPosition.Y == 1)
                {
                    int bottomLength = 1;
                    if (KeyboardInputManager.Downward(Keyboard.Key.Right) && currentScreenPosition.X < bottomLength)
                    {
                        soundactiv = true;
                        currentScreenPosition.X += 1;
                    }
                    if (KeyboardInputManager.Downward(Keyboard.Key.Left) && currentScreenPosition.X > 0)
                    {
                        soundactiv = true;
                        currentScreenPosition.X -= 1;
                    }
                }
                if ((KeyboardInputManager.Downward(Keyboard.Key.Left) || KeyboardInputManager.Downward(Keyboard.Key.Right)) && currentScreenPosition.Y == 0)
                {
                    if (KeyboardInputManager.Downward(Keyboard.Key.Left))
                    {
                        if (currentLevel > 0)
                        {
                            soundactiv = true;
                            currentLevel--;
                            currentScreenPosition.X -= 1;
                            if (currentScreenPosition.X < 0)
                            {
                                InitiateSlide(false);
                                currentScreenPosition.X = GetPositionOnCurrentLevelScreen();
                            }
                        }
                    }
                    else
                    {
                        if (stars.levelIsUnlocked(currentLevel + 1))
                        {
                            soundactiv = true;
                            currentLevel++;
                            currentScreenPosition.X = GetPositionOnCurrentLevelScreen();
                            if (GetPositionOnCurrentLevelScreen() == 0)
                            {
                                InitiateSlide(true);
                            }
                        }
                    }
                    if (soundactiv)
                    {
                        MusicManager.PlaySound(AssetManager.SoundName.MenueClick);
                    }
                    else if (KeyboardInputManager.Downward(Keyboard.Key.Up) || KeyboardInputManager.Downward(Keyboard.Key.Down) || KeyboardInputManager.Downward(Keyboard.Key.Right) || KeyboardInputManager.Downward(Keyboard.Key.Left))
                    {
                        MusicManager.PlaySound(AssetManager.SoundName.Wall);
                    }

                    return(GameState.LoadLevelState);
                }

                if (soundactiv)
                {
                    MusicManager.PlaySound(AssetManager.SoundName.MenueClick);
                }
                else if (KeyboardInputManager.Downward(Keyboard.Key.Up) || KeyboardInputManager.Downward(Keyboard.Key.Down) || KeyboardInputManager.Downward(Keyboard.Key.Right) || KeyboardInputManager.Downward(Keyboard.Key.Left))
                {
                    MusicManager.PlaySound(AssetManager.SoundName.Wall);
                }



                if (KeyboardInputManager.Downward(Keyboard.Key.Return) && currentScreenPosition.Y == 0)
                {
                    return(StartLevelIfUnlocked());
                }
                if (KeyboardInputManager.Downward(Keyboard.Key.Return) && currentScreenPosition.Y == 1) //Wurde die LinkeMaustaste gedrückt?
                {
                    switch (currentScreenPosition.X)                                                    //Bin mit der Maus über den Index: SwitchCaseWeg
                    {                                                                                   //bearbeitet das aktuelle TextFeld
                    //
                    case 0:
                        CanSlide(false);
                        return(GameState.LoadLevelState);

                    case 1:
                        CanSlide(true);
                        return(GameState.LoadLevelState);

                    default:
                        return(GameState.LoadLevelState);
                    }
                }
                else
                {
                    if (index != -1)
                    {
                        IntRect curRect = rectList[index];
                        debugRect.Position  = new Vector2f(curRect.Left, curRect.Top);
                        debugRect.Size      = new Vector2f(curRect.Width, curRect.Height);
                        debugRect.FillColor = Color.Cyan;
                    }
                }
            }
            return(GameState.LoadLevelState);
        }
Пример #6
0
 public InGameState(int id)
 {
     MusicManager.StopMusic();
     game = new Game(id);
 }
Пример #7
0
        public void Update(float deltaTime, Map map)
        {
            if (teleporting)
            {
                UpdateBots(deltaTime, map, getListOfBotPositions());
                UpdateSpritePosition(map);
                Teleporting(deltaTime);
                currentFocus = teleSpritePos;
            }
            else if (isAlive == true)
            {
                if (controllid != 0)
                {
                    SwitchToGhostPlayer();
                }
                UpdateBots(deltaTime, map, getListOfBotPositions());

                if (KeyboardInputManager.Downward(Keyboard.Key.Space))
                {
                    ghostaktiv = true;
                }

                if (iserstellt)
                {
                    ghostPlayer.Update(deltaTime, map, this);
                    currentFocus = new Vector2(ghostPlayer.mapPosition.X * sizePerCell + sizePerCell * 0.5f, ghostPlayer.mapPosition.Y * sizePerCell + sizePerCell * 0.5f);
                    UpdateSpritePosition(map);
                }
                else
                {
                    if (id == controllid)
                    {
                        Vector2i move = GetMove();
                        if (map.CellIsWalkable(mapPosition + move))
                        {
                            mapPosition = mapPosition + move;
                            if (move.X != 0 || move.Y != 0) //ProSchritt wird der Counter um 1 erhöht
                            {
                                scoreCounter++;
                            }
                        }
                        else if (map.MoveIsPossible(mapPosition, move, this.getListOfBotPositions()))
                        {
                            map.MoveBlock(mapPosition, move);
                            mapPosition = mapPosition + move;
                            scoreCounter++;
                        }
                        else
                        {
                            MusicManager.PlaySound(AssetManager.SoundName.Wall);
                        }
                        UpdateSpritePosition(map);
                        currentFocus = sprite.Position + new Vector2f(sprite.Size.X / 2f, sprite.Size.Y / 2f);
                    }
                }
                //Create GhostPlayer
                if (ghostaktiv && (!iserstellt) && controllid == 0)
                {
                    ghostPlayer = new GhostPlayer(mapPosition, map);
                    iserstellt  = true;
                }
                if (!ghostaktiv)
                {
                    ghostPlayer = null;
                    iserstellt  = false;
                }
                //Destroy GhostPlayer
                else if (KeyboardInputManager.Upward(Keyboard.Key.Space) || iserstellt && ghostPlayer.GetCount() == 0)
                {
                    ghostPlayer = null;
                    ghostaktiv  = false;
                    iserstellt  = false;
                }

                //Target controll manager
                SwitchTarget();
                UpdateSpritePosition(map);
            }
            else
            {
                //SPieler ist tod

                if (!_musicPlayed)
                {
                    MusicManager.PlaySound(AssetManager.SoundName.VirusDetected);
                    _musicPlayed = true;
                }
                playerdetected.Position = new Vector2f(235, 200);
                playerdetected.Color    = Color.Red;
                playerdetected.Style    = Text.Styles.Bold;
                restartGame.Position    = new Vector2f(285, 350);
                restartGame.Color       = Color.Red;
                restartGame.Style       = Text.Styles.Bold;
            }
        }