예제 #1
0
        private void checkTutorialNeed(ManageStars.Rating levelRating, int curIndex, List <Tutorial> tutoList)
        {
            Tutorial nextTutorial = tutoList.Find(t => t.index == curIndex && !t.shown);

            if (nextTutorial != null)
            {
                if (hackWatch == null)
                {
                    hackWatch = new Stopwatch();
                    hackWatch.Start();
                }
                if (levelRating == ManageStars.Rating.Fail)
                {
                    switch (curIndex)
                    {
                    // sort the cases latest to earliest
                    case 0:
                        if (hackWatch.ElapsedMilliseconds > 1000)
                        {
                            nextTutorial.ActivateSecretPowers();
                        }
                        break;

                    case 1:
                        if (KeyboardInputManager.PressedKeys().Count > 0 && player.mapPosition.Equals(new Vector2i(4, 3)))
                        {
                            nextTutorial.ActivateSecretPowers();
                        }
                        break;

                    case 12:
                        if (player.redbot && player.botList.Count > 0 && player.botList[0].mapPosition.Equals(new Vector2i(4, 3)) && nextTutorial.tutorialIndex == 4)
                        {
                            nextTutorial.ActivateSecretPowers(); break;
                        }
                        else if (player.redbot && KeyboardInputManager.PressedKeys().Count != 0 && nextTutorial.tutorialIndex == 3)
                        {
                            nextTutorial.ActivateSecretPowers(); break;
                        }
                        else if (nextTutorial.tutorialIndex == 2 && player.ghostaktiv && player.ghostPlayer.mapPosition.Equals(new Vector2i(7, 3)))
                        {
                            nextTutorial.ActivateSecretPowers(); break;
                        }
                        else if (player.ghostaktiv && nextTutorial.tutorialIndex == 1)
                        {
                            nextTutorial.ActivateSecretPowers(); break;
                        }
                        else if (player.redItemCounter > 0 && nextTutorial.tutorialIndex == 0)
                        {
                            nextTutorial.ActivateSecretPowers(); break;
                        }
                        break;
                    }
                    if (nextTutorial.shown)
                    {
                        currentTutorial = nextTutorial;
                    }
                }
            }
        }
예제 #2
0
 public LevelSelectButton(Vector2f _position, int _buttonLevel, Vector2i _screenPosition, ManageStars.Rating _rating)
 {
     position           = _position;
     sprite             = new Sprite(AssetManager.GetTexture(AssetManager.TextureName.LevelButtonGlow));
     sprite.Texture     = AssetManager.GetTexture(AssetManager.TextureName.LevelButton);
     sprite.Origin      = new Vector2f(sprite.Texture.Size.X * 0.5f, sprite.Texture.Size.Y);
     sprite.TextureRect = new IntRect(0, 0, (int)sprite.Texture.Size.X, (int)sprite.Texture.Size.Y);
     sprite.Position    = position;
     spriteRect         = new IntRect((int)(position.X - sprite.Texture.Size.X * 0.5f), (int)(position.Y - sprite.Texture.Size.Y * 0.5f), (int)sprite.Texture.Size.X, (int)sprite.Texture.Size.Y);
     highlighted        = false;
     buttonLevel        = _buttonLevel;
     screenPosition     = _screenPosition;
     rating             = _rating;
 }
예제 #3
0
        public void SetNewLevel(LevelSelectButton _button, ManageStars.Rating _rating)
        {
            button = _button;
            rating = _rating;

            levelName = new SuperText("Level " + (button.buttonLevel + 1), font, 0.2f);
            levelName.CharacterSize = 50;
            levelName.Position      = position + new Vector2(23, 205);

            screenShot.Texture = AssetManager.GetScreenShot(button.buttonLevel);

            lines = new List <RectangleShape>();
            foreach (Vector2 v in cornerPositions)
            {
                lines.Add(GenerateLine(v, button.position, 2));
            }

            SetAllAphas(highlighted? 100 : 50);
        }
예제 #4
0
        public LevelInfo(LevelSelectButton _button, Vector2f _position, ManageStars.Rating _rating)
        {
            position            = _position;
            background          = new Sprite(AssetManager.GetTexture(AssetManager.TextureName.LevelInfo));
            background.Origin   = new Vector2f(background.Texture.Size.X * 0.5f, background.Texture.Size.X * 0.5f);
            background.Position = (Vector2f)position + background.Origin;

            screenShot          = new Sprite(AssetManager.GetScreenShot(_button.buttonLevel));
            screenShot.Position = position + new Vector2(20, 20);

            defaultLineColor = new Color(255, 255, 255);
            float cornerDist = 10;

            cornerPositions = new List <Vector2>();
            cornerPositions.Add(position + new Vector2(cornerDist, cornerDist));
            cornerPositions.Add(position + new Vector2(background.Texture.Size.X, 0) + new Vector2(-cornerDist, cornerDist));
            cornerPositions.Add(position + new Vector2(0, background.Texture.Size.Y) + new Vector2(cornerDist, -cornerDist));
            cornerPositions.Add(position + new Vector2(background.Texture.Size.X, background.Texture.Size.Y) + new Vector2(-cornerDist, -cornerDist));

            SetNewLevel(_button, _rating);
        }
예제 #5
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);
        }