revival/game/Assets/Scripts/Artefacts/ArtefactInventory.cs

26 lines
648 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "KernelPanic/Artefacts/Inventory")]
public class ArtefactInventory : ScriptableObject
{
private readonly List<Artefact> artefactList = new List<Artefact>();
public void addA(Artefact a)
{
//check if duplicate in the list
foreach (Artefact x in artefactList)
{
if (x.artefactID == a.artefactID)
{
Debug.LogError($"{a} already exists in inventory", this);
return;
}
}
artefactList.Add(a);
}
}