public GameState Update(RenderWindow win, float deltaTime) { nextGameState = game.Update(deltaTime); if (Keyboard.IsKeyPressed(Keyboard.Key.Escape)) { game.SaveGame(); MusicManager.StopSound(); ProfileConstants.curLevel = game.curIndex; return(GameState.LoadLevelState); } return(nextGameState); }
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); }