您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
43 行
661 B
43 行
661 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CollectibleItem : MonoBehaviour
|
|
{
|
|
|
|
[SerializeField] private Item _currentItem = default;
|
|
[SerializeField] private SpriteRenderer[] _itemImages = default;
|
|
private void Start()
|
|
{
|
|
if (_itemImages != null)
|
|
SetCubeItem();
|
|
}
|
|
|
|
public void PickedItem()
|
|
{
|
|
|
|
|
|
}
|
|
|
|
public Item GetItem()
|
|
{
|
|
|
|
return _currentItem;
|
|
|
|
}
|
|
public void SetItem(Item item)
|
|
{
|
|
_currentItem = item;
|
|
|
|
}
|
|
//this function is only for testing
|
|
public void SetCubeItem()
|
|
{
|
|
for (int i = 0; i < _itemImages.Length; i++)
|
|
{
|
|
_itemImages[i].sprite = _currentItem.PreviewImage;
|
|
}
|
|
|
|
}
|
|
|
|
}
|