This commit is contained in:
Gerard Gascón 2025-04-24 16:56:52 +02:00
commit 862afc9b7a
478 changed files with 197737 additions and 0 deletions

View file

@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
public static class Inventory
{
public static List<GameObject> Items = new List<GameObject>();
public static int Index = 0;
public static void cycleItem() {
if (Items.Count > 0) {
Index = (Index + 1) % Items.Count;
}
}
public static GameObject getActiveItem() {
return Items[Index];
}
public static void addItem(GameObject go) {
if (!containsItem(go)) {
Items.Add(go);
}
}
public static bool containsItem(GameObject i) {
bool found = false;
foreach (GameObject a in Items) {
if (a.name.Equals(i.name)) {
found = true;
break;
}
}
return found;
}
}