void Awake() { aS = GameObject.Find("SoundManager").GetComponent <AudioSource>(); StartCoroutine(fadeOut()); manoMapa.gameObject.SetActive(false); manoPath.gameObject.SetActive(false); manoCombustible.gameObject.SetActive(false); foreach (GameObject go in cartelesTutorial) { go.gameObject.SetActive(false); } indTutorial = 0; nivel = GameObject.Find("Nivel").gameObject; //Se inicializan los atributos para el A* mapa = new int[alto, ancho]; int it = 0; for (int i = 0; i < alto; i++) { for (int j = 0; j < ancho; j++) { if (nivel.transform.GetChild(it).gameObject.layer == 8) { mapa[i, j] = 20; } else { mapa[i, j] = 1; } it++; } } //Descomentar para escribir el mapa por consola. #region EscribirMapa /* * string s = ""; * for(int i = 0; i< alto; i++) * { * for(int j = 0; j < ancho; j++) * { * s += mapa[i, j].ToString() + " "; * } * //Debug.Log(s); * s += "\n"; * } * Debug.Log(s); */ #endregion solver = new AStarSolver(ancho, alto); //Se inicializa el solver. solver.ActualizaMapa(mapa); meta.x = Mathf.FloorToInt(metaO.transform.position.x); meta.y = Mathf.FloorToInt(-metaO.transform.position.y); }