using System;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.BossRoom.Infrastructure
{
///
/// ScriptableObject class that contains a list of a given type. The instance of this ScriptableObject can be
/// referenced by components, without a hard reference between systems.
///
///
public abstract class RuntimeCollection : ScriptableObject
{
public List Items = new List();
public event Action ItemAdded;
public event Action ItemRemoved;
public void Add(T item)
{
if (!Items.Contains(item))
{
Items.Add(item);
ItemAdded?.Invoke(item);
}
}
public void Remove(T item)
{
if (Items.Contains(item))
{
Items.Remove(item);
ItemRemoved?.Invoke(item);
}
}
}
}