SteveC
Member
Hey y'all!
Was wondering what the best way to sort ItemTypes by Category is. My scenario, and I'm just starting to think about how to extend the inventory, starts with just seeing what returns what:
Seems to return what I'd expect, dropping weapons or picking them up is reflected in the lists.
My formal question is, how would I differentiate the ItemTypes by Category, so I could then track which are weapons, which are ammunition, etc.. and work from there. Are there better ways to sort these values?
As a broader question, is there an expected way to hook to the inventory system? I previously used Inventory Pro as an example to help me attempt to hook into the inventory system but it looks like that's no longer integrated.
Are there any assets that are recommended for extending the Inventory? I wouldn't be opposed to using an outside asset, currently was going to use NGUI to build the UI and construct my own inventory handler.
Thanks much!
Was wondering what the best way to sort ItemTypes by Category is. My scenario, and I'm just starting to think about how to extend the inventory, starts with just seeing what returns what:
Code:
public class PlayerInventoryManager : MonoBehaviour {
public List<Item> m_CurrentItemList;
public List<ItemType> m_CurrentItemTypeList;
public Inventory m_OpsiveInventory;
void Update()
{
if(Input.GetKeyDown(KeyCode.L)) {
ReturnCurrentInventory ();
}
}
public void ReturnCurrentInventory()
{
m_CurrentItemList.Clear ();
m_CurrentItemTypeList.Clear ();
List<Item> Items = m_OpsiveInventory.GetAllItems ();
foreach (Item item in Items) {
m_CurrentItemList.Add (item);
}
List<ItemType> ItemTypes = m_OpsiveInventory.GetAllItemTypes ();
foreach (ItemType itemType in ItemTypes) {
m_CurrentItemTypeList.Add (itemType);
}
}
}
Seems to return what I'd expect, dropping weapons or picking them up is reflected in the lists.
My formal question is, how would I differentiate the ItemTypes by Category, so I could then track which are weapons, which are ammunition, etc.. and work from there. Are there better ways to sort these values?
As a broader question, is there an expected way to hook to the inventory system? I previously used Inventory Pro as an example to help me attempt to hook into the inventory system but it looks like that's no longer integrated.
Are there any assets that are recommended for extending the Inventory? I wouldn't be opposed to using an outside asset, currently was going to use NGUI to build the UI and construct my own inventory handler.
Thanks much!
Last edited: