internal void AddBlocks(IEnumerable <Trigger> triggers) { lock (syncObj) { Trigger nextTrig = Trigger.Undefined, curTrig = Trigger.Undefined; TriggerBlock block = new TriggerBlock(5); foreach (var trig in triggers) { curTrig = nextTrig; nextTrig = trig; if (curTrig != Trigger.Undefined) { Size++; block.Add(curTrig); } if ((curTrig.Category == TriggerCategory.Effect) && nextTrig.Category == TriggerCategory.Cause) { triggerBlocks.Add(block); block = new TriggerBlock(5); } if (Size > engine.Options.TriggerLimit) { throw new MonkeyspeakException("Trigger limit exceeded."); } } block.Add(nextTrig); triggerBlocks.Add(block); } }
/// <summary> /// A Reader that is used to get Variables, Strings, and Numbers from Triggers /// </summary> /// <param name="page"></param> /// <param name="trigger"></param> public TriggerReader(Page page, TriggerBlock currentBlock) { this.page = page; engine = page.Engine; if (currentBlock != null) { this.currentBlock = new TriggerBlock(currentBlock); } }