using Svelto.ECS; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GamecraftModdingAPI.Events { class SimpleEventHandlerEngine : IEventHandlerEngine { public object type { get; set; } public string Name { get; set; } private readonly Action onEvent; public IEntitiesDB entitiesDB { set; private get; } public void Add(ref ModEventEntityStruct entityView, EGID egid) { if (entityView.type.Equals(this.type)) { onEvent.Invoke(entitiesDB); } } public void Ready() { } public void Remove(ref ModEventEntityStruct entityView, EGID egid) { } public SimpleEventHandlerEngine(Action handleEvent, object type, string name) : this((IEntitiesDB db) => { handleEvent.Invoke(); }, type, name) { } public SimpleEventHandlerEngine(Action handleEvent, object type, string name) { this.type = type; this.Name = name; this.onEvent = handleEvent; } } }