void Start() { manager = GetComponent <appleLevelManager>(); regulator = GetComponent <difficultyRegulator>(); treeAnim = GameObject.FindGameObjectWithTag("tree").GetComponent <Animator>(); shadowAnim = GameObject.FindGameObjectWithTag("shadow").GetComponent <Animator>(); difficultyLevel = 1; totalApples = 0; lastPos = -1; }
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; }