/// <summary> /// Handles pressing the back button in android. /// Go from aboutUs to the MainMenu. /// Go from writeToUs to the MainMenu. /// Go from achievmentsInCanvas to the MainMenu. /// Go from PossessedTasks to the MainMenu. /// Go from LogicTasks to the MainMenu. /// Go from ContentBalls to the PossessedTasks. /// Go from ContentBalls to the LogicTasks. /// Go from GameLevel to the ContentBalls. /// </summary> void Update() { if (Input.GetKeyDown(KeyCode.Escape)) //МЫ НАЖАЛИ НА КНОПКУ НАЗАД { if (GlobalSceneObjects.aboutUs.activeInHierarchy == true) //если у нас открыто Об Игре { AboutUs.Exit(); GlobalSounds.transfer.PlayDelayed(0.15f); } if (GlobalSceneObjects.writeToUs.activeInHierarchy == true)//если у нас открыто Об Игре { WriteToUs.Exit(); GlobalSounds.transfer.PlayDelayed(0.15f); } if (GlobalSceneObjects.achievmentsInCanvas.activeInHierarchy == true)//если у нас открыто Об Игре { Achievments.Exit(); GlobalSounds.transfer.PlayDelayed(0.15f); } if ((GlobalSceneObjects.logicTasks.activeInHierarchy == true || GlobalSceneObjects.possessedTasks.activeInHierarchy == true)) { GlobalSounds.transfer.PlayDelayed(0.15f); coroutines.InvokeHideTextLevelHouse(GlobalSceneObjects.showNextPage.transform.Find("Text").GetComponent <TextMeshProUGUI>().text); if (GlobalVariables.isPossessedHouse) { GlobalSceneObjects.showNextPage.GetComponent <Animator>().SetTrigger("HideLogicTrigger"); GlobalSceneObjects.logicTasks.GetComponent <Animator>().SetTrigger("HideTrigger"); } else { GlobalSceneObjects.showNextPage.GetComponent <Animator>().SetTrigger("HidePossessedTrigger"); GlobalSceneObjects.possessedTasks.GetComponent <Animator>().SetTrigger("HideTrigger"); } GlobalVariables.stateForAnimation = (int)GlobalVariables.NameAnimation.MainMenu; } for (int numberBall = 0; numberBall < GlobalSceneObjects.contentBalls.transform.childCount; numberBall++) { if (GlobalSceneObjects.contentBalls.transform.GetChild(numberBall).gameObject.activeInHierarchy == true)//если мы в каком либо шаре , то есть выбираем номер уровня, то скрываем эти уровни и переходим к шарикам { HideContentBalls.Invoke(); GlobalVariables.stateForAnimation = (int)GlobalVariables.NameAnimation.PlayButton; GlobalSounds.pressButton.Play(); //звук нажатия GlobalSounds.transfer.PlayDelayed(0.15f); //звук скрытия } } if (GlobalSceneObjects.gameLevels.activeInHierarchy == true)//если у нас открыт уровень, который мы проходим и мы нажали назад,то { HideLevelContent.Invoke(); HideLevelButtons.Invoke(); GlobalVariables.stateForAnimation = GlobalVariables.activeNameLevel; GlobalSounds.transfer.PlayDelayed(0.15f); } } }
public static void Invoke(string NameLevel) { Coroutines coroutines = GameObject.FindObjectOfType(typeof(Coroutines)) as Coroutines; GlobalSounds.transfer.PlayDelayed(0.15f); coroutines.InvokeHideTextLevelHouse(GlobalSceneObjects.showNextPage.transform.Find("Text").GetComponent <TMPro.TextMeshProUGUI>().text); if (GlobalVariables.isPossessedHouse) { GlobalSceneObjects.showNextPage.GetComponent <Animator>().SetTrigger("HideLogicTrigger"); GlobalSceneObjects.logicTasks.GetComponent <Animator>().SetTrigger("HideTrigger"); } else { GlobalSceneObjects.showNextPage.GetComponent <Animator>().SetTrigger("HidePossessedTrigger"); GlobalSceneObjects.possessedTasks.GetComponent <Animator>().SetTrigger("HideTrigger"); } switch (NameLevel) { case "LightTests": GlobalVariables.stateForAnimation = (int)GlobalVariables.NameAnimation.LightTests; break; case "BestPractices": GlobalVariables.stateForAnimation = (int)GlobalVariables.NameAnimation.BestPractices; break; case "ScientistsNotes": GlobalVariables.stateForAnimation = (int)GlobalVariables.NameAnimation.ScientistsNotes; break; case "ExperimentalProcess": GlobalVariables.stateForAnimation = (int)GlobalVariables.NameAnimation.ExperimentalProcess; break; case "AcademicDegree": GlobalVariables.stateForAnimation = (int)GlobalVariables.NameAnimation.AcademicDegree; break; case "SimpleLever": GlobalVariables.stateForAnimation = (int)GlobalVariables.NameAnimation.SimpleLever; break; case "ElementaryLaws": GlobalVariables.stateForAnimation = (int)GlobalVariables.NameAnimation.ElementaryLaws; break; case "Mechanics": GlobalVariables.stateForAnimation = (int)GlobalVariables.NameAnimation.Mechanics; break; case "LatestDevelopments": GlobalVariables.stateForAnimation = (int)GlobalVariables.NameAnimation.LatestDevelopments; break; } }