27 lines
921 B
C#
27 lines
921 B
C#
|
using Sirenix.OdinInspector;
|
||
|
using UnityEngine;
|
||
|
|
||
|
// ReSharper disable once CheckNamespace
|
||
|
namespace BlueWaterProject
|
||
|
{
|
||
|
public class ItemDropManager : Singleton<ItemDropManager>
|
||
|
{
|
||
|
[field: Title("아이템")]
|
||
|
[field: SerializeField] public GameObject ItemPrefab { get; private set; }
|
||
|
[SerializeField] private Transform instantiateObjects;
|
||
|
[SerializeField] private Transform items;
|
||
|
|
||
|
[Button("셋팅 초기화")]
|
||
|
private void Init()
|
||
|
{
|
||
|
instantiateObjects = GameObject.Find("InstantiateObjects").transform;
|
||
|
items = instantiateObjects.transform.Find("Items");
|
||
|
}
|
||
|
|
||
|
public void DropItem(Item item, Vector3 dropPosition)
|
||
|
{
|
||
|
var itemController = Instantiate(ItemPrefab, dropPosition, Quaternion.identity, items).GetComponentInChildren<ItemController>();
|
||
|
itemController.Init(item);
|
||
|
}
|
||
|
}
|
||
|
}
|