Пример #1
0
    void Start()
    {
        /*lettersList[0]= new string [] { "H", "O", "L", "A" };
         * lettersList[1] = new string[] { "P", "A", "L", "O" };
         * lettersList[2] = new string[] { "A", "L", "T", "O" };
         * lettersList[3] = new string[] { "A", "R", "B", "O","L" };
         * lettersList[4] = new string[] { "M", "A", "L", "E", "T", "A" };*/

        //Paraliza el juego cuando la app queda en segundo plano.
        Application.runInBackground = false;

        level = 1;

        dlevels     = GetComponent <TrainDifficultylevels>();
        lettersList = dlevels.getLevelList(level);

        TrainGenerator = GetComponent <trainGenerator>();
        WordTester     = GetComponent <wordTester>();
        messageGrandma = FindObjectOfType <grandmaMessage>();
        countdownTimer = 70f;

        levelState = "Initial";
    }
Пример #2
0
    void Start()
    {
        audioScript    = FindObjectOfType <AudioScript>();
        countdownTimer = 70;

        applesSinceLastGood = 0;
        //Paraliza el juego cuando la app queda en segundo plano.
        Application.runInBackground = false;

        dLevels        = GetComponent <difficultyLevels>();
        messageGrandma = FindObjectOfType <grandmaMessage>();
        diffRegulator  = GetComponent <difficultyRegulator>();

        //carga el nivel de difficultad guardado y le restamos uno para comenzar más ligero.
        if (GameData.currentGame.diffLevelOflevels[1] > 1)
        {
            diffLevel = GameData.currentGame.diffLevelOflevels[1] - 1;
        }
        else
        {
            diffLevel = GameData.currentGame.diffLevelOflevels[1];
        }

        syllablesList = dLevels.getLevelList();

        goodSyllable = syllablesList[Random.Range(0, syllablesList.Length)];


        probabilityDictionary = new Dictionary <string, float>();
        syllablesDictionary   = new Dictionary <string, float>();

        float probabilityUni = 60f / (syllablesList.Length - 1); //Debug.Log("syllables: "+ syllablesList.Length+ " prob: "+probabilityUni);
        float probability    = 0;

        foreach (string syll in syllablesList)
        {
            if (syll == goodSyllable)
            {
                probability += 40f;
                syllablesDictionary.Add(syll, probability);
                probabilityDictionary.Add(syll, 40f);
            }
            else
            {
                probability += probabilityUni;
                syllablesDictionary.Add(syll, probability);
                probabilityDictionary.Add(syll, probabilityUni);
            }

            Debug.Log("Silaba: " + syll + " Probabilidad/100: " + syllablesDictionary[syll] + " Probab: " + probabilityDictionary[syll]);
        }
        Debug.Log("  ");
        setNextSyllable();



        appleVelocity = 2f;
        timer         = 0f;
        numApples     = 0;
        //gameOn = false;
        // zoomOn = false;

        treeAnim   = GameObject.FindGameObjectWithTag("tree").GetComponent <Animator>();
        shadowAnim = GameObject.FindGameObjectWithTag("shadow").GetComponent <Animator>();

        interfControl = GetComponent <InterfaceControl>();

        //gameFinal= GameObject.FindGameObjectWithTag("Finish") ;
        //camera = Camera.main;
    }