示例#1
0
    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);
    }
示例#2
0
    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;
            }
        }
    }