Beispiel #1
0
        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));
            }
        }