Sorry for the basic question.
I am creating an action to be taken when the main storage overflows.
Doesn't work.
I am creating an action to be taken when the main storage overflows.
Doesn't work.
namespace Opsive.UltimateInventorySystem.ItemActions
{
using Opsive.UltimateInventorySystem.Core.InventoryCollections;
using Opsive.UltimateInventorySystem.Core.DataStructures;
using UnityEngine;
[System.Serializable]
public class OverflowToStorageAction : ItemViewSlotsContainerItemAction
{
[SerializeField] public Inventory m_StorageInventory;
public OverflowToStorageAction()
{
m_Name = "OverflowToStorage";
}
protected override bool CanInvokeInternal(ItemInfo itemInfo, ItemUser itemUser)
{
var MainStorage = GameObject.FindWithTag("Storage");
if (MainStorage == null) { Debug.Log("MainStorage null"); }
m_StorageInventory = MainStorage.GetComponent<Inventory>();
if (m_StorageInventory == null)
{ Debug.Log("Storege " + m_StorageInventory); }
return m_StorageInventory != null;
}
protected override void InvokeActionInternal(ItemInfo itemInfo, ItemUser itemUser)
{
// ストレージインベントリーに追加
m_StorageInventory.AddItem(itemInfo);
}
}
}
Last edited: