Exemplo n.º 1
0
    public static void Open()
    {
        CheckPassedLevel.Check();
        int     passedTasks  = 0;
        int     passedInRow  = 0;
        int     currentLevel = 0;
        Vector4 normalColor  = new Vector4(255, 255, 255, 1);
        Vector4 redColor     = new Vector4(255, 0, 0, 1);

        for (int numberBall = 0; numberBall < GlobalSaves.saveInGame.Length; numberBall++)
        {
            currentLevel = 0;
            passedTasks  = 0;

            for (int row = 0; row < GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").childCount; row++)
            {
                passedInRow = 0;
                try
                {
                    for (int columnInPreviousRow = 0; columnInPreviousRow < GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row - 1).childCount; columnInPreviousRow++)
                    {
                        if (GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row - 1).GetChild(columnInPreviousRow).name.Contains("Level"))
                        {
                            if (GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row - 1).GetChild(columnInPreviousRow).Find("Star").GetComponent <Image>().color == (Color)normalColor ||
                                GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row - 1).GetChild(columnInPreviousRow).Find("Star").GetComponent <Image>().color == (Color)redColor)
                            {
                                passedInRow++;
                            }
                        }
                    }
                }
                catch (Exception) {}
                if (GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).name.Contains("Level"))
                {
                    for (int column = 0; column < GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).childCount; column++)
                    {
                        if (GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column).name.Contains("Level"))
                        {
                            currentLevel++;
                            try
                            {
                                //Open 7-9 level when passing 5 levels
                                if ((GlobalSaves.saveInGame[numberBall].isRateLevelsCheck[currentLevel] == true || GlobalSaves.saveInGame[numberBall].isSkipRateLevelsCheck[currentLevel] == true) && currentLevel <= 6)
                                {
                                    passedTasks++;
                                }
                                if (passedTasks >= 5 && (currentLevel == 7 || currentLevel == 8 || currentLevel == 9))
                                {
                                    GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column).Find("Level").GetComponent <Button>().interactable = true;
                                    GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column).Find("Level").Find("mark").gameObject.SetActive(false);
                                    GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column).Find("Level").Find("Image").gameObject.SetActive(true);
                                }
                            }
                            catch (Exception) { }
                            try
                            {
                                //open 10+ levels
                                if (passedInRow >= 2 && GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row - 1).GetChild(column).Find("Level").GetChild(1).name.Contains("mark"))
                                {
                                    for (int currentColumn = 0; currentColumn <= column; currentColumn++)
                                    {
                                        GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column - currentColumn).Find("Level").GetComponent <Button>().interactable = true;
                                        GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column - currentColumn).Find("Level").Find("mark").gameObject.SetActive(false);
                                        GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column - currentColumn).Find("Level").Find("Image").gameObject.SetActive(true);
                                    }
                                }
                            }
                            catch (Exception) { }

                            try
                            {
                                // If the level is skipped
                                if (GlobalSaves.saveInGame[numberBall].isSkipRateLevelsCheck[currentLevel] == true && GlobalSaves.saveInGame[numberBall].isRateLevelsCheck[currentLevel] == false)
                                {
                                    GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column).Find("Star").GetComponent <Image>().sprite = GlobalSprites.spritesStarsLevels[numberBall];
                                    GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column).Find("Star").GetComponent <Image>().color  = new Vector4(255, 0, 0, 1);// red color
                                    GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column).Find("Star").Find("Lighting").gameObject.SetActive(true);
                                }
                                //If the level is not skipped
                                if (GlobalSaves.saveInGame[numberBall].isRateLevelsCheck[currentLevel] == true)
                                {
                                    GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column).Find("Star").GetComponent <Image>().sprite = GlobalSprites.spritesStarsLevels[numberBall];
                                    GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column).Find("Star").GetComponent <Image>().color  = new Vector4(255, 255, 255, 1);// normal color
                                    GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column).Find("Star").Find("Lighting").gameObject.SetActive(true);
                                    GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).Find("Content").GetChild(row).GetChild(column).Find("ButtonLighting").gameObject.SetActive(true);
                                }
                            }
                            catch (Exception) { }
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
    public static void SetVisibleObject()
    {
        switch (GlobalVariables.stateForAnimation)
        {
        case (int)GlobalVariables.NameAnimation.Achiev:
            GlobalSceneObjects.achievmentsInCanvas.gameObject.SetActive(true);
            GlobalSceneObjects.mainMenu.gameObject.SetActive(false);
            GlobalSceneObjects.achievmentsButton.gameObject.SetActive(false);
            break;

        case (int)GlobalVariables.NameAnimation.MainMenu:

            GlobalSceneObjects.mainMenu.gameObject.SetActive(true);
            GlobalSceneObjects.achievmentsButton.gameObject.SetActive(true);
            GlobalSceneObjects.aboutUs.gameObject.SetActive(false);
            GlobalSceneObjects.writeToUs.gameObject.SetActive(false);
            GlobalSceneObjects.logicTasks.gameObject.SetActive(false);
            GlobalSceneObjects.possessedTasks.gameObject.SetActive(false);
            GlobalSceneObjects.showNextPage.gameObject.SetActive(false);
            GlobalSceneObjects.achievmentsInCanvas.gameObject.SetActive(false);

            GlobalSceneObjects.gameLevels.gameObject.SetActive(false);
            GlobalSceneObjects.level_4.gameObject.SetActive(false);
            GlobalSceneObjects.currentLevel.gameObject.SetActive(false);
            GlobalSceneObjects.continueButton.gameObject.SetActive(false);
            GlobalSceneObjects.helpBoard.gameObject.SetActive(false);
            GlobalSceneObjects.tableSkip.gameObject.SetActive(false);
            GlobalSceneObjects.tableRate.gameObject.SetActive(false);

            ReturnText();
            break;

        case (int)GlobalVariables.NameAnimation.PlayButton:
            CheckPassedLevel.Check();
            GlobalSceneObjects.showNextPage.gameObject.SetActive(true);
            GlobalSceneObjects.logicTasks.gameObject.SetActive(true);
            GlobalSceneObjects.possessedTasks.gameObject.SetActive(true);
            if (GlobalVariables.isPossessedHouse == false)
            {
                GlobalSceneObjects.possessedTasks.GetComponent <Animator>().SetTrigger("ShowTrigger");
                GlobalSceneObjects.showNextPage.GetComponent <Animator>().SetTrigger("ShowPossessedTrigger");
            }
            if (GlobalVariables.isPossessedHouse == true)
            {
                GlobalSceneObjects.logicTasks.GetComponent <Animator>().SetTrigger("ShowTrigger");
                GlobalSceneObjects.showNextPage.GetComponent <Animator>().SetTrigger("ShowLogicTrigger");
            }
            GlobalSceneObjects.mainMenu.gameObject.SetActive(false);
            GlobalSceneObjects.achievmentsButton.gameObject.SetActive(false);
            for (int numberBall = 0; numberBall < GlobalSceneObjects.contentBalls.transform.childCount; numberBall++)
            {
                GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).gameObject.SetActive(false);
            }
            OpenPassedLevels.Open();
            break;

        case (int)GlobalVariables.NameAnimation.AboutUs:
            GlobalSceneObjects.aboutUs.gameObject.SetActive(true);
            GlobalSceneObjects.mainMenu.gameObject.SetActive(false);
            GlobalSceneObjects.achievmentsButton.gameObject.SetActive(false);
            break;

        case (int)GlobalVariables.NameAnimation.WriteToUs:
            GlobalSceneObjects.writeToUs.gameObject.SetActive(true);
            GlobalSceneObjects.mainMenu.gameObject.SetActive(false);
            GlobalSceneObjects.achievmentsButton.gameObject.SetActive(false);
            break;

        case (int)GlobalVariables.NameAnimation.LightTests:
            DisableHousesAndGoToChooseLvl("LightTests");
            break;

        case (int)GlobalVariables.NameAnimation.BestPractices:
            DisableHousesAndGoToChooseLvl("BestPractices");
            break;

        case (int)GlobalVariables.NameAnimation.ScientistsNotes:
            DisableHousesAndGoToChooseLvl("ScientistsNotes");
            break;

        case (int)GlobalVariables.NameAnimation.ExperimentalProcess:
            DisableHousesAndGoToChooseLvl("ExperimentalProcess");
            break;

        case (int)GlobalVariables.NameAnimation.AcademicDegree:
            DisableHousesAndGoToChooseLvl("AcademicDegree");
            break;

        case (int)GlobalVariables.NameAnimation.SimpleLever:
            DisableHousesAndGoToChooseLvl("SimpleLever");
            break;

        case (int)GlobalVariables.NameAnimation.ElementaryLaws:
            DisableHousesAndGoToChooseLvl("ElementaryLaws");
            break;

        case (int)GlobalVariables.NameAnimation.Mechanics:
            DisableHousesAndGoToChooseLvl("Mechanics");
            break;

        case (int)GlobalVariables.NameAnimation.LatestDevelopments:
            DisableHousesAndGoToChooseLvl("LatestDevelopments");
            break;

        case (int)GlobalVariables.NameAnimation.GameLevel:
            for (int numberBall = 0; numberBall < GlobalSceneObjects.contentBalls.transform.childCount; numberBall++)
            {
                GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).gameObject.SetActive(false);
            }
            GlobalSceneObjects.gameLevels.gameObject.SetActive(true);
            break;

        case (int)GlobalVariables.NameAnimation.HelpBoard:
            GlobalSceneObjects.helpBoard.gameObject.SetActive(false);
            break;

        case (int)GlobalVariables.NameAnimation.TableSkip:
            GlobalSceneObjects.tableSkip.gameObject.SetActive(false);
            break;

        case (int)GlobalVariables.NameAnimation.TableRate:
            GlobalSceneObjects.tableRate.gameObject.SetActive(false);
            break;

        case (int)GlobalVariables.NameAnimation.ButtonContinue:
            GlobalSceneObjects.continueButton.gameObject.SetActive(true);
            break;

        case (int)GlobalVariables.NameAnimation.NewLevel:
            GlobalSceneObjects.currentLevel.gameObject.SetActive(false);
            GlobalSceneObjects.level_4.gameObject.SetActive(false);
            SaveInGame.numberLvlClick++;
            LoadLevel.Load(SaveInGame.numberLvlClick);
            break;

        case (int)GlobalVariables.NameAnimation.Task:
            if (GlobalSceneObjects.currentLevel.activeInHierarchy == true)
            {
                GlobalSceneObjects.task.gameObject.SetActive(false);
                GlobalSceneObjects.task.gameObject.SetActive(true);
            }
            else
            {
                GameObject task        = GlobalSceneObjects.level_4.transform.Find("Task").gameObject;
                GameObject centContent = GlobalSceneObjects.level_4.transform.Find("Content").gameObject;
                task.gameObject.SetActive(false);
                task.gameObject.SetActive(true);
                centContent.gameObject.SetActive(false);
                centContent.gameObject.SetActive(true);
            }
            LoadLevel.Load(SaveInGame.numberLvlClick);
            break;
        }
        GlobalVariables.stateForAnimation = 0;
    }