コード例 #1
0
ファイル: MainInit.cs プロジェクト: madm1nds/LogicTasks
    /// <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);
            }
        }
    }
コード例 #2
0
    /// <param name="NumberClickParams">Loadable level number</param>
    public static void Invoke(int NumberClickParams)
    {
        GlobalSounds.pressButton.Play();
        GlobalSounds.transfer.PlayDelayed(0.15f);
        HideContentBalls.Invoke();

        GlobalVariables.stateForAnimation = (int)GlobalVariables.NameAnimation.GameLevel;

        SaveInGame.numberLvlClick = NumberClickParams;
        LoadLevel.Load(SaveInGame.numberLvlClick);
    }