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

26 lines
648 B
C#
Raw Normal View History

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