IEnumerator colorRestGet() { UnityWebRequest api = UnityWebRequest.Get(restUrl); yield return(api.SendWebRequest()); if (api.isNetworkError || api.isHttpError) { Debug.Log(api.error); } else { tipoEstrella = JsonUtility.FromJson <TipoEstrella>(@"{""type"": ""G""}"); } tipoEstrella = JsonUtility.FromJson <TipoEstrella>(@"{""type"": ""G""}"); letra = tipoEstrella.type.ToString(); }
IEnumerator dataStarRestGet() { UnityWebRequest api = UnityWebRequest.Get(restUrl + "/stardata/" + this.masa.ToString() + "&" + this.radio.ToString()); yield return(api.SendWebRequest()); if (api.isNetworkError || api.isHttpError) { Debug.Log(api.error); } else { this.dataEstrella = JsonUtility.FromJson <TipoEstrella>(api.downloadHandler.text); } if (dataEstrella.valid == 1) { float radio1 = radio * 0.2f; GameObject starGO = Instantiate(star, Vector3.zero, Quaternion.identity); Star star1 = starGO.GetComponent <Star>(); star1.transform.localScale = Vector3.one * 2 * radio1; star1.initStar(name, masa, radio, dataEstrella.type); star1.t_eff = dataEstrella.T_eff; star1.per_main_sec = dataEstrella.per_main_sec; star1.lum_s = dataEstrella.lum_s; ColorEstrellaCtrol.singleton.CambiarColor("G"); starList.Add(starGO); this.valid = true; } else { starModal.GetComponent <StarModelController>().turnON(); this.valid = false; } yield return(this.valid); }