Example #1
0
 void Update()
 {
     if (isTiming)
     {
         timer -= Time.deltaTime;
         if (timer < 0)
         {
             isTiming = false;
             //animator.SetTrigger("fadeOut");
             Destroy(gameObject, 2.0f);
             creditManger.CreateCreditOb();
         }
     }
 }
Example #2
0
    public void LevelBeaten()
    {
        Debug.Log(TAG + "level beaten menu.");
        int  curFolder = levelManager.GetCurFolder();
        int  curLevel  = levelManager.GetCurLevelNum();
        bool isCustom  = levelManager.GetIsCustom();

        tutorialManager.FadeOut();

        Level[] levels;
        if (isCustom)
        {
            levels = levelManager.GetCustomLevels(curFolder);
        }
        else
        {
            levels = levelManager.GetLevels();
        }
        //If still levels left
        if (levels.Length > curLevel + 1)
        {
            menuAllLevelsBeaten.SetActive(false);
            menuLevelBeaten.SetActive(true);
            levelBeatenAni.Play("fadeInComplete");
            ProgressManager.CheckLevelBeaten(curFolder, curLevel);

            return;
        }
        //if this was the last level
        //check if there are more chapters
        //don't do it for custom chapters
        if (levelManager.GetIsCustom())
        {
            menuAllLevelsBeaten.SetActive(false);
            menuLevelBeaten.SetActive(false);
            backToCustomLevels.SetActive(true);
            customFolderBeatenAni.Play("fadeInComplete");
            return;
        }
        if (chapterManager.GetChapters().Length > levelManager.GetCurFolder() + 1)
        {
            Debug.Log(TAG + "there are more chapters");
            if (mainManager.GetISDemo() && levelManager.GetCurFolder() + 1 > 2)
            {
                OpenDemoMenu();
                ProgressManager.CheckChapterBeaten(curFolder);
                return;
            }
            folderBeatenText.text = "Chapter " + (curFolder + 1).ToString() + " Complete";
            menuLevelBeaten.SetActive(false);
            menuAllLevelsBeaten.SetActive(true);
            folderBeatenAni.Play("fadeInComplete");
            ProgressManager.CheckChapterBeaten(curFolder);
            return;
        }

        Debug.Log(TAG + "all levels complete");

        menuLevelBeaten.SetActive(false);
        //menuGameOver.SetActive(true);
        folderBeatenAni.Play("fadeInComplete");

        //Show the end credits
        GameObject g = Instantiate(endCreditsPrefab);

        menuButton.SetActive(false);
        resetButton.SetActive(false);
        g.transform.position = c.transform.position - new Vector3(0, 20, 0);
        CreditsManager creditManager = g.GetComponent <CreditsManager>();

        creditManager.LoadCredits(this, soundManager);

        creditManager.CreateCreditOb();
    }