public void setItemTemplate(ItemTemplate itemTemp) { item = itemTemp; //item.itemPrefab.sprite; // Sprite myFruit = Resources.Load("fruits_1", typeof(Sprite)) as Sprite; if (item.itemMaestro != null) { sprite = UtilsItems.getSprite(item.itemMaestro.sprite); GetComponent <Image>().sprite = sprite; } }
public void setSpriteTo(ItemTemplate item) { int zone = item.itemMaestro.posicion; switch (zone) { case 1: headGO.GetComponent <SpriteRenderer>().sprite = UtilsItems.getSprite(item.itemMaestro.sprite); temHead = item; break; case 2: troncoGO.GetComponent <SpriteRenderer>().sprite = UtilsItems.getSprite(item.itemMaestro.sprite); temTronco = item; break; case 3: List <SpriteRenderer> spritesRend = new List <SpriteRenderer>(piesGO.GetComponentsInChildren <SpriteRenderer>()); spritesRend.ForEach(h => h.sprite = UtilsItems.getSprite(item.itemMaestro.sprite)); temPies = item; break; } }