Beispiel #1
0
    public void OpenChapterMenu(int chapterId)
    {
        GameManager.Instance.CurrentChapter = chapterId;
        Debug.Log("Open chapter: " + chapterId);
        Debug.Log("Current chapter: " + GameManager.Instance.CurrentChapter);
        menuCamera.SetChapterSelected(chapterId);

        if (!chapterMenuIsOpen)
        {
            menuLevels.enabled = true;
            chapterMenuIsOpen  = true;
            //chapterButtonsPanel.SetActive(false);
            metaDataIcon.gameObject.SetActive(false);
            if (menuChapterAnimator != null)
            {
                int nbLightCollectibleTaken  = 0;
                int nbShadowCollectibleTaken = 0;

                int totalNbLightCollectible  = 0;
                int totalNbShadowCollectible = 0;

                int nbCompleted = 0;
                int totalLevel  = 0;

                List <Level> levels = chapters[GameManager.Instance.CurrentChapter].GetLevels();
                foreach (Level l in levels)
                {
                    //Light collectibles
                    foreach (bool collectible in l.LightCollectibles)
                    {
                        if (collectible == true)
                        {
                            nbLightCollectibleTaken++;
                        }
                    }
                    totalNbLightCollectible += l.LightCollectibles.Length;

                    //shadow collectibles
                    foreach (bool collectible in l.ShadowCollectibles)
                    {
                        if (collectible == true)
                        {
                            nbShadowCollectibleTaken++;
                        }
                    }
                    totalNbShadowCollectible += l.ShadowCollectibles.Length;
                    if (l.Completed)
                    {
                        nbCompleted++;
                    }
                    totalLevel++;
                }

                //                levelLabel.text = chaptersName[localIndexCurrentChapter].ToUpper();
                menuChapterAnimator.SetBool("open", true);
                menuCamera.SetZoom(true);
                menuLevels.SetMenuLevels(GameManager.Instance.CurrentChapter);
            }
        }
    }
Beispiel #2
0
 public void OnSelect(BaseEventData eventData)
 {
     GameManager.Instance.CurrentChapter = chapterNumber;
     menuCamera.SetChapterSelected(chapterNumber);
     GameObject.FindObjectOfType <MenuChapter>().UpdateChapterName(chapterNumber);
 }