private bool hechaCarga = false; //Indica si se ha llevado a cabo una carga //Update y transiciones de estados ------------------------------------------------------------------------------------------------------- void Awake() { Random.seed = System.DateTime.Now.Millisecond; UnityEngine.Random.seed = System.DateTime.Now.Millisecond; Debug.Log(FuncTablero.formateaTiempo() + ": Iniciando el script Principal..."); //Se busca el objeto con los valores guardados en la escena inicial, si lo hubiera contenedor = GameObject.FindGameObjectWithTag("Carga"); if (contenedor == null) //Si el objeto no existe, crear el planeta de cero { Debug.Log(FuncTablero.formateaTiempo() + ": No encontrado contenedor, iniciando creacion inicial..."); creacionInicial(); contenedor = new GameObject("Contenedor"); contenedor.tag = "Carga"; contenedor.AddComponent <ValoresCarga>(); } else //Si el objeto existe, cargar los valores necesarios { Debug.Log(FuncTablero.formateaTiempo() + ": Encontrado contenedor, cargando..."); ValoresCarga cont = contenedor.GetComponent <ValoresCarga>(); creacionCarga(cont); hechaCarga = true; } Debug.Log(FuncTablero.formateaTiempo() + ": Completada la creacion del planeta."); mejoras = GameObject.FindGameObjectWithTag("Mejoras").GetComponent <MejorasNave>(); interfaz = gameObject.GetComponent <InterfazPrincipal>(); materiales = GameObject.FindGameObjectWithTag("Materiales").GetComponent <Materiales> (); }
//Update y transiciones de estados ------------------------------------------------------------------------------------------------------- void Awake() { Random.seed = System.DateTime.Now.Millisecond; UnityEngine.Random.seed = System.DateTime.Now.Millisecond; Debug.Log (FuncTablero.formateaTiempo() + ": Iniciando el script Principal..."); //Se busca el objeto con los valores guardados en la escena inicial, si lo hubiera contenedor = GameObject.FindGameObjectWithTag("Carga"); if (contenedor == null) { //Si el objeto no existe, crear el planeta de cero Debug.Log (FuncTablero.formateaTiempo() + ": No encontrado contenedor, iniciando creacion inicial..."); creacionInicial(); contenedor = new GameObject("Contenedor"); contenedor.tag = "Carga"; contenedor.AddComponent<ValoresCarga>(); } else { //Si el objeto existe, cargar los valores necesarios Debug.Log (FuncTablero.formateaTiempo() + ": Encontrado contenedor, cargando..."); ValoresCarga cont = contenedor.GetComponent<ValoresCarga>(); creacionCarga(cont); hechaCarga = true; } Debug.Log (FuncTablero.formateaTiempo() + ": Completada la creacion del planeta."); mejoras = GameObject.FindGameObjectWithTag("Mejoras").GetComponent<MejorasNave>(); interfaz = gameObject.GetComponent<InterfazPrincipal>(); materiales = GameObject.FindGameObjectWithTag ("Materiales").GetComponent<Materiales> (); }
void Start() { principal = gameObject.GetComponent<Principal> (); mejoras = GameObject.FindGameObjectWithTag ("Mejoras").GetComponent<MejorasNave> (); materiales = GameObject.FindGameObjectWithTag ("Materiales").GetComponent<Materiales> (); togglesFiltros = new bool[24]; togglesFiltrosOld = new bool[24]; habitabilidadSeleccion = new float[9]; infoSeleccion = new List<string> (); //Cargar la información del numero de saves que hay SaveLoad.compruebaRuta (); numSaves = SaveLoad.FileCount (); nombresSaves = new string[numSaves]; nombresSaves = SaveLoad.getFileNames (); numSavesExtra = numSaves - 3; if (numSavesExtra < 0) numSavesExtra = 0; //Cargar la informacion del sonido que hay en PlayerPrefs if (PlayerPrefs.HasKey ("MusicaVol")) musicaVol = PlayerPrefs.GetFloat ("MusicaVol"); if (PlayerPrefs.HasKey ("SfxVol")) sfxVol = PlayerPrefs.GetFloat ("SfxVol"); if (PlayerPrefs.HasKey ("MusicaOn") && (PlayerPrefs.GetInt ("MusicaOn") == 0)) musicaVol = 0.0f; if (PlayerPrefs.HasKey ("SfxOn") && (PlayerPrefs.GetInt ("SfxOn") == 0)) sfxVol = 0.0f; Audio_Ambiente ambiente = sonidoAmbiente.GetComponent<Audio_Ambiente> (); if (PlayerPrefs.HasKey ("MusicaOn") && (PlayerPrefs.GetInt ("MusicaOn") == 0)) ambiente.activado = false; else ambiente.activado = true; ambiente.volumen = musicaVol; //Volumen del audio de efectos Audio_SoundFX efectos = sonidoFX.GetComponent<Audio_SoundFX> (); if (PlayerPrefs.HasKey ("SfxOn") && (PlayerPrefs.GetInt ("SfxOn") == 0)) efectos.activado = false; else efectos.activado = true; efectos.volumen = sfxVol; }