Exemplo n.º 1
0
        // display the next UILevel - if it exists and if it is unlocked, then place it
        public static bool NextLevel()
        {
            Debug.Log("NEXTLVL - LevelManager.GetLastStoryLevel() " + LevelManager.GetLastStoryLevel());
            if (activeUILevel + 1 <= ProgressManager.GetProgress().storyProgress.lastUnlockedLevel&& activeUILevel + 1 <= LevelManager.GetLastStoryLevel())
            {
                unlockNextLevel = false;
                Debug.Log("ProgressManager.GetProgress().lastUnlockedLevel " + ProgressManager.GetProgress().storyProgress.lastUnlockedLevel);
                activeUILevel++;
                ProgressManager.GetProgress().storyProgress.lastPlayedLevelID = activeUILevel;

                UILevelPlacer.newUnlocks = UILevel.StarsToUnlock.none;
                UILevelPlacer.PlaceUILevel(activeUILevel, true);

                UILevelDrag.UpdateDragObject();

                // move the numbers left, bringing the nextLevel into focus, removing those outside
                for (int i = UILevelPlacer.placedLevelNumbers.Count - 1; i >= 0; i--)
                {
                    UILevelPlacer.placedLevelNumbers[i].Left();
                }

                //try to place leftover levels
                for (int i = -2; i <= 2; i++)
                {
                    UILevelPlacer.PlaceLevelNumber(UILevelPlacer.placedLevel.id + i, i);
                }

                onUILevelSwitch.Invoke(activeUILevel);

                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        // display the last UILevel - if it exists and if it is unlocked, then place it
        public static bool LastLevel()
        {
            int firstStoryLevel = LevelManager.GetFirstStoryLevel();

            if (activeUILevel - 1 >= firstStoryLevel && firstStoryLevel >= 0)
            {
                unlockNextLevel = false;
                activeUILevel--;
                ProgressManager.GetProgress().storyProgress.lastPlayedLevelID = activeUILevel;

                UILevelPlacer.newUnlocks = UILevel.StarsToUnlock.none;
                UILevelPlacer.placedLevel.FadeOut();
                //delay this
                UILevelPlacer.PlaceUILevel(activeUILevel, true);
                UILevelDrag.UpdateDragObject();

                // backwards iteration needed, because we might remove items during iterating from the collection
                for (int i = UILevelPlacer.placedLevelNumbers.Count - 1; i >= 0; i--)
                {
                    UILevelPlacer.placedLevelNumbers[i].Right();
                }

                //try to place leftover levels
                for (int i = -2; i <= 2; i++)
                {
                    UILevelPlacer.PlaceLevelNumber(UILevelPlacer.placedLevel.id + i, i);
                }
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     _instance = this;
 }
Exemplo n.º 4
0
        private void Start()
        {
            Game.gameType = Game.GameType.story;
            Main.onSceneChange.AddListener(SceneChanging);
            LevelManager.onLevelChange.AddListener(LevelChanging);

            UILevelDrag.UpdateDragObject();

            if (unlockNextLevel)
            {
                NextWasUnlocked();
            }

            nextLevelGetsUnlocked = false;
            playPressed           = false;

            //fadeAnimation.Play("fadeFromBlack");
            //uiLevelAnimation.Play("uiLevelselectionFadeIn");
        }