void DroppedUI(GameObject dragged) { ingredientFx.Play(); audioSource.PlayOneShot(salpica); IngredienteItem ii = dragged.GetComponent <IngredienteItem> (); PocionesData.Valores v = valoresParciales.Find(x => x.id == ii.id); v.val += itemMult; UpdateReceta(false); }
void SetCombiLevel() { //int pLevel = Data.Instance.pocionesData.currentLevel; pLevelData = Data.Instance.pocionesData.GetLevel(); valores = new List <PocionesData.Valores> (); valoresParciales = new List <PocionesData.Valores> (); for (int i = 0; i < pLevelData.elementos.Length; i++) { PocionesData.Valores v = new PocionesData.Valores(); v.id = i; v.val = pLevelData.elementos[i]; valores.Add(v); } ingredientes = new List <PocionesData.Ingrediente> (); foreach (PocionesData.Ingrediente g in Data.Instance.pocionesData.ingredientes) { ingredientes.Add(g); } Utils.Shuffle(valores); Utils.Shuffle(ingredientes); consigna.SetActive(true); ConsignaPociones cs = consigna.GetComponent <ConsignaPociones> (); cs.ResetIcons(); //cs.texto.text = "Para un buen color lograr,\nestos elementos balancear:\n"; cs.texto.text = ""; receta.SetActive(true); RecetaPociones rp = receta.GetComponent <RecetaPociones> (); rp.texto.text = ""; for (int i = 0; i < valores.Count; i++) { PocionesData.Valores v = new PocionesData.Valores(); v.id = valores [i].id; valoresParciales.Add(v); if (Array.Exists(pLevelData.respuestas_index, x => x == valores [i].id)) { Debug.Log(valores [i].id); GameObject slot = Instantiate(ingredienteSlot); slot.transform.SetParent(inventarioContent); slot.transform.localPosition = Vector3.zero; slot.transform.localScale = Vector3.one; slot.transform.SetAsLastSibling(); slots.Add(slot); //CombinatoriasData.Gema g = ingredientes.Find (x => x.size == i); GameObject gi = Instantiate(ingredienteItem); gi.transform.SetParent(slot.transform); gi.transform.localPosition = Vector3.zero; gi.transform.localScale = Vector3.one; //gi.transform.SetAsLastSibling(); IngredienteItem gis = gi.GetComponent <IngredienteItem> (); gis.image.sprite = ingredientes [i].sprite; //gis.text.text = ingredientes[i].name; gis.id = valores [i].id; rp.texto.text += "-> ¿" + v.val + "?\n"; cs.texto.text += "" + valores [i].val + " " + ingredientes [i].name + "\n"; cs.images [i].sprite = ingredientes [i].sprite; cs.images [i].color = Color.white; } else { if (Array.Exists(pLevelData.pistas_elementos_index, x => x == valores [i].id)) { Color c = pocionesColors[(Data.Instance.levelsData.actualDiamondLevel + 1) % Data.Instance.levelsData.diamondLevels.Count]; /*if (Data.Instance.levelsData.actualDiamondLevel == 3) * c = pocionesColors;*/ rp.texto.text += "-> " + " <color=" + Utils.rgb2Hex(c.r, c.g, c.b) + "><b>" + Math.Round(valores [i].val * pLevelData.factor) + "</b></color>\n"; cs.texto.text += "<color=" + Utils.rgb2Hex(c.r, c.g, c.b) + "><b>" + valores [i].val + "</b></color> " + ingredientes [i].name + "\n"; } else { cs.texto.text += "" + valores [i].val + " " + ingredientes [i].name + "\n"; rp.texto.text += "\n"; } cs.images [i].sprite = ingredientes [i].sprite; cs.images [i].color = Color.white; } } }