public void AddItem(PuzzleItem item) { ItemFront itemFront = Instantiate(itemPrefab) as ItemFront; itemFront.transform.parent = transform; itemFront.gameObject.name = "Item " + item.GetType().Name.Replace("Puzzle", ""); itemFront.Set(this, item); items.Add(itemFront); }
private void SetItem(PuzzleItem puzzleItem) { string name = puzzleItem.GetType().Name.Replace("Puzzle", ""); foreach (var item in items) { if (item.name == name) { staticSprite.sprite = item.image; } } }