示例#1
0
 /// <summary>
 /// Queues up the effects to the current night
 /// </summary>
 public void EnqueueEffects(ActionContext context)
 {
     // if (game.CurrentExecutionPipeline == null) return;
     foreach (BaseEffect effect in Effects)
     {
         EffectExecution execution = new EffectExecution
         {
             Effect  = effect,
             Context = new EffectContext
             {
                 Game            = context.Game,
                 ExecutingPlayer = context.PerformingPlayer,
                 ExecutingRole   = context.PerformingRole,
                 ExecutingAction = this,
                 Targets         = context.Targets,
             },
         };
         context.Game.EneqeueEffect(execution);
     }
 }
示例#2
0
        public void EneqeueEffect(EffectExecution execution)
        {
            EffectExecutionOrderEntry entry = new EffectExecutionOrderEntry
            {
                Effect          = execution.Effect,
                ExecutingAction = execution.Context.ExecutingAction,
                ExecutingRole   = execution.Context.ExecutingRole,
            };

            int key = Mode.ExecutionOrder.IndexOf(entry);

            if (key < 0)
            {
                return;
            }

            if (!effectQueue.ContainsKey(key) || effectQueue[key] == null)
            {
                effectQueue[key] = new List <EffectExecution>();
            }
            effectQueue[key].Add(execution);
        }