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");
     }
 }
Пример #4
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");
            }

        }
Пример #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();
 }
Пример #8
0
 /// <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));