private void generateCoeur(EnumVieEtat enu) { foreach (Vie vie in listVie) { if (vie.enu.Equals(enu)) { float decalX = 0.0f; GameObject temp = new GameObject(); if (listCoeur.Count > 0) { decalX = listCoeur [listCoeur.Count - 1].GetComponent <RectTransform> ().anchoredPosition[0] + 45.0f; } temp.AddComponent <UnityEngine.UI.Image> (); temp.GetComponent <UnityEngine.UI.Image> ().sprite = vie.image; temp.transform.parent = gameObject.transform; temp.GetComponent <RectTransform> ().anchorMin = new Vector2(0.5f, 0.5f); temp.GetComponent <RectTransform> ().anchorMax = new Vector2(0.5f, 0.5f); temp.GetComponent <RectTransform> ().anchoredPosition = new Vector3(decalX, 0.0f, 0.0f); temp.GetComponent <RectTransform> ().localScale = new Vector3(0.4f, 0.4f, 0.4f); //Instantiate(temp); listCoeur.Add(temp); break; } } }
private Sprite searchSprite(EnumVieEtat enu) { foreach (Vie vie in listVie) { if (vie.enu.Equals(enu)) { return(vie.image); } } return(null); }