using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Svelto.ECS;
using GamecraftModdingAPI.Utility;
namespace GamecraftModdingAPI.Events
{
///
/// A simple implementation of IEventEmitterEngine sufficient for most uses
///
public class SimpleEventEmitterEngine : IEventEmitterEngine
{
public string Name { get; set; }
public object type { get; set; }
public bool isRemovable { get; }
public IEntityFactory Factory { private get; set; }
public IEntitiesDB entitiesDB { set; private get; }
public void Ready() { }
///
/// Emit the event
///
public void Emit()
{
Factory.BuildEntity(ApiExclusiveGroups.eventID++, ApiExclusiveGroups.eventsExclusiveGroup)
.Init(new ModEventEntityStruct { type = type });
}
public void Dispose() { }
///
/// Construct the engine
///
/// The EventType to use for ModEventEntityStruct.type
/// The name of this engine
/// Will removing this engine not break your code?
public SimpleEventEmitterEngine(EventType type, string name, bool isRemovable = true)
{
this.type = type;
this.Name = name;
this.isRemovable = isRemovable;
}
///
/// Construct the engine
///
/// The object to use for ModEventEntityStruct.type
/// The name of this engine
/// Will removing this engine not break your code?
public SimpleEventEmitterEngine(object type, string name, bool isRemovable = true)
{
this.type = type;
this.Name = name;
this.isRemovable = isRemovable;
}
}
}