Beispiel #1
0
    // Public due to it being referenced by Dialog Background's ContinueButton.
    public void NextSentence()
    {
        continueButton.SetActive(false);
        gobackButton.SetActive(false);
        skip.SetActive(false);
        ReturntoFirstScene.SetActive(false);

        if (SceneManager.GetActiveScene().name == "7Game_Intro" && index == 1)
        {
            inicio.SetActive(false);
        }
        if (SceneManager.GetActiveScene().name == "Tutorial" && index == 1)  // Esto solo sucede en el tutorial de matemáticas de conteo


        {
            Pera.SetActive(true);
            Manzana2.SetActive(true);
            Manzana1.SetActive(true);
            Durazno1.SetActive(true);
            Durazno2.SetActive(true);
            source.enabled = false;
            handanimation.SetActive(true);
            dialogBackground.SetActive(false);
        }
        loader = GameObject.FindWithTag("Cross_Fade");
        if (SceneManager.GetActiveScene().name != "New Corrección")
        {
            if (index < sentences.Length - 1)
            {
                index++;
                UIText.text = "";
                StartCoroutine(Type());
            }
            else
            {
                UIText.text = "";
                dialogBackground.SetActive(false);

                if (SceneManager.GetActiveScene().name == "Agradecimiento" /* || SceneManager.GetActiveScene().name == "New Corrección"*/)
                {
                    endgame.SetActive(true);
                }
                else if (loader != null && loader.GetComponent <Levelloader>() != null)
                {
                    loader.GetComponent <Levelloader>().LoadNextLevel(continuarpresionado);
                }
                else
                {
                    SceneManager.LoadScene(sceneIndex + 1);
                }
            }
        }
        else
        {
            if (index < 3)
            {
                index++;
                UIText.text = "";
                StartCoroutine(Type());
            }
            else
            {
                UIText.text = "";
                dialogBackground.SetActive(false);

                currentFruitsPanel.gameObject.SetActive(false);
                currentFruitsIndexesText.gameObject.SetActive(false);
                //currentFruitsIndexesObject.SetActive(false);
                endgame.SetActive(true);

                /*if (SceneManager.GetActiveScene().name == "Agradecimiento"/* || SceneManager.GetActiveScene().name == "New Corrección")
                 *  endgame.SetActive(true);
                 * else
                 *  SceneManager.LoadScene(sceneIndex+1);
                 */
            }
        }
    }
Beispiel #2
0
    string SceneState; //Helps telling in which part of the game we are
    void Start()
    {
        // Commented so that it may be edited in the Inspector, given that each Scene's typing speed differs.
        typingSpeed = 0.02f;

        sceneIndex = SceneManager.GetActiveScene().buildIndex;

        dialogBackground.SetActive(true);
        continueButton.SetActive(false);
        gobackButton.SetActive(false);
        skip.SetActive(false);
        ReturntoFirstScene.SetActive(false);



        if (SceneManager.GetActiveScene().name == "Tutorial" && index == 0) //Tutorial de conteo
        {
            handanimation = GameObject.FindGameObjectWithTag("Hand");
            handanimation.SetActive(false);
            Pera.SetActive(false);
            Manzana2.SetActive(false);
            Manzana1.SetActive(false);
            Durazno1.SetActive(false);
            Durazno2.SetActive(false);
        }

        if (SceneManager.GetActiveScene().name == "7Game_Intro" && index == 0)
        {
            inicio = GameObject.FindGameObjectWithTag("Inicio");
            inicio.SetActive(false);
        }

        source = GetComponent <AudioSource>();
        //individualSource = new AudioSource();

        // Scene "Corrección"
        if (sceneIndex == 23)
        {
            // Declare typesOfFruits array.
            typesOfFruits = new int[initializer.fruits.Length];

            // Get total number of fruits instantiated.
            totalFruits = 0;

            for (int i = 0; i < initializer.fruits.Length; i++)
            {
                totalFruits += FruitInitialization.numFruits[i];
            }

            // Reference Panel displaying current fruits
            currentFruitsPanel = GameObject.Find("Current Fruits Panel");
            //currentFruitsPanel.name = "Pat";

            /* Reference Text object which indicates the indexes of each fruit currently displayed in the Current Fruits
             * Panel.
             */
            //currentFruitsIndexesObject = GameObject.Find("Fruit Indexes");
            currentFruitsIndexesText = GameObject.Find("Fruit Indexes")
                                       .GetComponent <Text>();        //currentFruitsIndexesObject.GetComponent<Text>();

            // Get number of fruits belonging to the first fruit index.
            for (int i = 0; i < initializer.fruits.Length; i++)
            {
                typesOfFruits[i] = FruitInitialization.numFruits[FruitInitialization.fruitIndexes[i]];
            }
        }

        /*
         * firstTypeOfFruits = FruitInitialization.numFruits[FruitInitialization.fruitIndexes[0]];
         * secondTypeOfFruits = FruitInitialization.numFruits[FruitInitialization.fruitIndexes[1]];
         * thirdTypeOfFruits = FruitInitialization.numFruits[FruitInitialization.fruitIndexes[2]];
         */

        StartCoroutine(Type());
    }