public static EntityTurnIterationEvent alloc(Entity p_entity) { EntityTurnIterationEvent l_instance = new EntityTurnIterationEvent(); l_instance.Entity = p_entity; return(l_instance); }
/// <summary> /// The iteration loop is : /// * Making a choice over a builded <see cref="_AI._DecisionTree.DecisionTree"/>. /// * Queueing <see cref="AEvent"/> based on AI choice. /// </summary> /// <param name="p_eventQueue"></param> public override void Execute(EventQueue p_eventQueue) { ExternalHooks.Profiler_BeginSample("EntityTurnIterationEvent"); if (TurnIteration.Iterate(Entity, p_eventQueue)) { EventQueue.enqueueEvent(p_eventQueue, EntityTurnIterationEvent.alloc(Entity)); } else { EventQueue.enqueueEvent(p_eventQueue, EntityTurnIterationEndEvent.alloc(Entity)); } ExternalHooks.Profiler_EndSample(); }
public override void Execute(EventQueue p_eventQueue) { Entity l_nextTurnEntity = TurnTimelineAlgorithm.IncrementTimeline(TurnTimeline); if (l_nextTurnEntity != null) { ActionPoint.resetActionPoints(EntityComponent.get_component <ActionPoint>(l_nextTurnEntity)); MyEvent <Entity> .broadcast(ref l_nextTurnEntity.OnEntityTurnStart, ref l_nextTurnEntity); // We wait for the EntityActionQueue to finish. EventQueue.enqueueEvent(p_eventQueue, IterateAndWaitForEmptyQueue.alloc(EntityActionQueue)); // We enqueue an EndTurnEvent to trigger end turn related events. The EndTurnEvent will enqueue another StartTurnEvent on completion. EventQueue.enqueueEvent(p_eventQueue, EndTurnEvent.alloc(TurnTimeline, EntityActionQueue, l_nextTurnEntity)); EventQueue.clearAll(EntityActionQueue); EventQueue.enqueueEvent(EntityActionQueue, EntityTurnIterationEvent.alloc(l_nextTurnEntity)); } }