Working on inventory 2
This commit is contained in:
parent
fd71606833
commit
eb61f607b1
3 changed files with 23 additions and 4 deletions
Binary file not shown.
|
@ -7,7 +7,7 @@ public class Inventory : MonoBehaviour
|
||||||
{
|
{
|
||||||
public Image[] itemImages = new Image[numItemSlots];
|
public Image[] itemImages = new Image[numItemSlots];
|
||||||
public Item[] items = new Item[numItemSlots];
|
public Item[] items = new Item[numItemSlots];
|
||||||
public const int numItemSlots = 6;
|
public const int numItemSlots = 25;
|
||||||
public void AddItem(Item itemToAdd)
|
public void AddItem(Item itemToAdd)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < items.Length; i++)
|
for (int i = 0; i < items.Length; i++)
|
||||||
|
|
|
@ -6,11 +6,30 @@ using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
public class MonsterManager : MonoBehaviour {
|
public class MonsterManager : MonoBehaviour {
|
||||||
|
|
||||||
void Start() {
|
public GameObject inventory;
|
||||||
|
public Item item;
|
||||||
|
|
||||||
|
private Inventory inv;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
inv = FindObjectOfType<Inventory> ();
|
||||||
|
giveItem (item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveMonster ()
|
public void giveItem(Item itm)
|
||||||
|
{
|
||||||
|
inv.AddItem (itm);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showItems()
|
||||||
|
{
|
||||||
|
if (inventory.activeSelf == false)
|
||||||
|
inventory.SetActive (true);
|
||||||
|
else inventory.SetActive (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveMonster()
|
||||||
{
|
{
|
||||||
StringBuilder eyePos = new StringBuilder();
|
StringBuilder eyePos = new StringBuilder();
|
||||||
|
|
||||||
|
|
Reference in a new issue