dddushesss 53ffc3a8f6 fixes
2022-02-05 22:15:01 +03:00

41 lines
935 B
C#

using DG.Tweening;
using UnityEngine;
namespace Items.ItemViews
{
public class ItemView : MonoBehaviour
{
private Item _item;
public bool pickedUp;
public string itemName;
public Item Item => _item;
public void SetUp(Item item)
{
_item = item;
pickedUp = false;
itemName = _item.name;
Rotate();
}
private void OnDestroy()
{
transform.DOKill();
}
private void Rotate()
{
transform.DORotate(transform.rotation.eulerAngles + new Vector3(0, 10, 0), 0.1f)
.SetEase(Ease.InQuad)
.SetLoops(-1, LoopType.Incremental)
.OnUpdate(() =>
{
if (pickedUp)
{
Destroy(gameObject);
}
});
}
}
}