using System.Collections; using System.Collections.Generic; using UnityEngine; public class ItemWorld : MonoBehaviour { public static ItemWorld SpawnItemWorld(Vector3 position, Item item) { Transform transform = Instantiate(ItemAssets.Instance.BluePotionPf, position, Quaternion.identity); ItemWorld itemWorld = transform.GetComponent(); itemWorld.SetItem(item); return itemWorld; } private Item item; private SpriteRenderer spriteRenderer; private void Awake() { spriteRenderer = GetComponent(); } public void SetItem(Item item) { this.item = item; } public Item GetItem() { return item; } public void DestroySelf() { Destroy(gameObject); } }