ItemContainer.cs

This commit is contained in:
s-prechtl 2022-05-20 08:48:33 +02:00
parent f969277910
commit 6836367207
2 changed files with 23 additions and 1 deletions

View file

@ -0,0 +1,22 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ItemContainer : MonoBehaviour {
public Item[] allItems;
// Start is called before the first frame update
public Item GetItemByName(String name) {
for (int i = 0; i < allItems.Length; i++) {
if (allItems[i].displayName == name) {
return allItems[i];
}
}
return null;
}
public int GetItemIdByName(String name) {
return GetItemByName(name).id;
}
}