using System;
using Unity.Jobs;
using RobocraftX.StateSync;
using Svelto.ECS;
using GamecraftModdingAPI.Utility;
namespace GamecraftModdingAPI.Events
{
///
/// Event emitter engine for switching to simulation mode.
///
public class GameStateSimulationEmitterEngine : IEventEmitterEngine, IInitializeOnSimulationStart
{
public string Name { get; } = "GamecraftModdingAPIGameStateSimulationEventEmitter" ;
public EntitiesDB entitiesDB { set; private get; }
public int type { get; } = (int)EventType.SimulationSwitchedTo;
public bool isRemovable { get; } = false;
public IEntityFactory Factory { set; private get; }
public void Dispose() { }
public void Emit()
{
Logging.Log("Dispatching Simulation Switched To event");
if (Factory == null) { return; }
Factory.BuildEntity(ApiExclusiveGroups.eventID++, ApiExclusiveGroups.eventsExclusiveGroup)
.Init(new ModEventEntityStruct { type = type });
}
public JobHandle OnInitializeSimulationMode()
{
Emit();
return default(JobHandle);
}
public void Ready() { }
}
}