Exemplo n.º 1
0
    public static void LevelFinished()
    {
        if (Instance.practiceMode)
        {
            Instance.levelInfo.levelFinishedPractice = true;
            AchievementManager.AchievementCollected(Instance.lvlCompletePracticeAchievID);
        }
        else
        {
            if (Instance.levelInfo.shardsCollected.x == 0 && Instance.shardsCollected.x == 1)
            {
                Instance.levelInfo.shardsCollected.x = 1; PlayerStatsistics.Instance.totalHiddenShardsCollected++;
            }
            if (Instance.levelInfo.shardsCollected.y == 0 && Instance.shardsCollected.y == 1)
            {
                Instance.levelInfo.shardsCollected.y = 1; PlayerStatsistics.Instance.totalHiddenShardsCollected++;
            }
            if (Instance.levelInfo.shardsCollected.z == 0 && Instance.shardsCollected.z == 1)
            {
                Instance.levelInfo.shardsCollected.z = 1; PlayerStatsistics.Instance.totalHiddenShardsCollected++;
            }

            if (Instance.shardsCollected == Vector3.one)
            {
                AchievementManager.AchievementCollected(Instance.allHiddenShardsAchievID);
            }

            AchievementManager.CheckHiddenShardsAchiev();

            if (!Instance.levelInfo.levelFinished)
            {
                PlayerStatsistics.Instance.totalStarsCollected += Instance.levelInfo.maxStars;
                Instance.levelInfo.levelFinished = true;
                AchievementManager.AchievementCollected(Instance.lvlCompleteAchievID);
            }

            AchievementManager.CheckStarsCollectedAchiev();
        }

        Instance.SaveLevel();
        Instance.gameplayUI.ShowLevelCompletePanel();
        PauseGame();
        Instance.totalAttempts   = 0;
        Instance.totalJumps      = 0;
        Instance.shardsCollected = Vector3.zero;
    }