BITFALL/Assets/Artists/Scripts/Player/Hotkey/EntityHotkeyCollection.cs

17 lines
510 B
C#

using System.Collections;
using System.Collections.Generic;
using BITKit;
using UnityEngine;
namespace BITFALL.Hotkey
{
[CustomType(typeof(IHotkeyCollection))]
public class EntityHotkeyCollection : MonoBehaviour,IHotkeyCollection
{
public IEnumerable<IHotkeyProvider> Hotkeys => _hotkeys;
private readonly List<IHotkeyProvider> _hotkeys = new();
public void Register(IHotkeyProvider hotkey)=>_hotkeys.TryAdd(hotkey);
public void UnRegister(IHotkeyProvider hotkey)=>_hotkeys.TryRemove(hotkey);
}
}