public TSLGeneratorCombinator(double probability, GenerateDelegate generateFunc, TSLGeneratorCombinator <R> next = null)
 {
     Probability           = probability;
     CumulativeProbability = probability + (next?.CumulativeProbability ?? 0.0);
     GenerateFunc          = generateFunc;
     NextCombinator        = next;
 }
示例#2
0
 public static void Generate(GenerateDelegate generator)
 {
     if (generator != null)
     {
         generator();
     }
 }
示例#3
0
 static void GenerateWithException(GenerateDelegate method, ICodeBlock codeBlock, IElement element, IPlugin plugin, PluginManager pluginManager)
 {
     try
     {
         method(codeBlock, element);
     }
     catch (Exception e)
     {
         PluginContainer pluginContainer = pluginManager.PluginContainers[plugin];
         pluginContainer.Fail(e, "Failed during code generation");
     }
 }
        static void GenerateWithException(GenerateDelegate method, ICodeBlock codeBlock, IElement element, IPlugin plugin, PluginManager pluginManager)
        {
            try
            {
                method(codeBlock, element);
            }
            catch (Exception e)
            {
                PluginContainer pluginContainer = pluginManager.PluginContainers[plugin];
                pluginContainer.Fail(e, "Failed during code generation");
            }

        }
示例#5
0
 public ParticleGenerator(GeneratorAtributes generatorAtributes, GenerateDelegate generateDelegate)
 {
     this.generatorAtributes = generatorAtributes;
     this.generateDelegate   = generateDelegate;
 }
示例#6
0
        /// <summary>
        /// Performs world generation asynchronously
        /// </summary>
        /// <param name="range">chunks to generate</param>
        /// <param name="callback">this callback will be called when world will be generated</param>
        /// <param name="state"></param>
        public IAsyncResult GenerateAsync(Range3I range, AsyncCallback callback, object state)
        {
            var del = new GenerateDelegate(Generate);

            return(del.BeginInvoke(range, callback, state));
        }
示例#7
0
 public static void Generate(GenerateDelegate generator)
 {
     if (generator != null) generator();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CustomKeyGenerator" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="generator">The generator.</param>
 /// <exception cref="ArgumentOutOfRangeException">generator</exception>
 public CustomKeyGenerator(string name, GenerateDelegate generator) : base(name)
     => _delegate = generator ?? throw new ArgumentOutOfRangeException(nameof(generator));