26 lines
553 B
C#
26 lines
553 B
C#
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public abstract class RuntimeSetSO<T> : ScriptableObject
|
||
|
{
|
||
|
[HideInInspector] [SerializeField] private List<T> items = new();
|
||
|
|
||
|
public IReadOnlyCollection<T> Items => items;
|
||
|
public bool IsEmpty => items.Count == 0;
|
||
|
|
||
|
public void Add(T thing)
|
||
|
{
|
||
|
if (!items.Contains(thing))
|
||
|
{
|
||
|
items.Add(thing);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void Remove(T thing)
|
||
|
{
|
||
|
if (items.Contains(thing))
|
||
|
{
|
||
|
items.Remove(thing);
|
||
|
}
|
||
|
}
|
||
|
}
|