2021-02-14 16:08:59 +01:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
2021-02-23 14:05:42 +01:00
|
|
|
[CreateAssetMenu(menuName = "KernelPanic/Artefacts/Inventory")]
|
2021-02-19 16:14:14 +01:00
|
|
|
public class ArtefactInventory : ScriptableObject
|
2021-02-14 16:08:59 +01:00
|
|
|
{
|
2021-02-23 14:05:42 +01:00
|
|
|
private readonly List<Artefact> artefactList = new List<Artefact>();
|
2021-02-14 16:08:59 +01:00
|
|
|
|
2021-02-23 14:05:42 +01:00
|
|
|
public void addA(Artefact a)
|
2021-02-14 16:08:59 +01:00
|
|
|
{
|
|
|
|
//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-14 16:08:59 +01:00
|
|
|
}
|
|
|
|
|
2021-02-23 14:05:42 +01:00
|
|
|
artefactList.Add(a);
|
2021-02-14 16:08:59 +01:00
|
|
|
}
|
|
|
|
}
|