Example #1
0
        private void SetupRenderers(IEnumerable <IKeyValueCollection> rendererData)
        {
            var renderers = new List <IParticleRenderer>();

            foreach (var rendererInfo in rendererData)
            {
                var rendererClass = rendererInfo.GetProperty <string>("_class");
                if (ParticleControllerFactory.TryCreateRender(rendererClass, rendererInfo, vrfGuiContext, out var renderer))
                {
                    renderers.Add(renderer);
                }
                else
                {
                    Console.WriteLine($"Unsupported renderer class '{rendererClass}'.");
                }
            }

            Renderers = renderers;
        }
Example #2
0
        private void SetupInitializers(IEnumerable <IKeyValueCollection> initializerData)
        {
            var initializers = new List <IParticleInitializer>();

            foreach (var initializerInfo in initializerData)
            {
                var initializerClass = initializerInfo.GetProperty <string>("_class");
                if (ParticleControllerFactory.TryCreateInitializer(initializerClass, initializerInfo, out var initializer))
                {
                    initializers.Add(initializer);
                }
                else
                {
                    Console.WriteLine($"Unsupported initializer class '{initializerClass}'.");
                }
            }

            Initializers = initializers;
        }
Example #3
0
        private void SetupOperators(IEnumerable <IKeyValueCollection> operatorData)
        {
            var operators = new List <IParticleOperator>();

            foreach (var operatorInfo in operatorData)
            {
                var operatorClass = operatorInfo.GetProperty <string>("_class");
                if (ParticleControllerFactory.TryCreateOperator(operatorClass, operatorInfo, out var @operator))
                {
                    operators.Add(@operator);
                }
                else
                {
                    Console.WriteLine($"Unsupported operator class '{operatorClass}'.");
                }
            }

            Operators = operators;
        }
Example #4
0
        private void SetupEmitters(IKeyValueCollection baseProperties, IEnumerable <IKeyValueCollection> emitterData)
        {
            var emitters = new List <IParticleEmitter>();

            foreach (var emitterInfo in emitterData)
            {
                var emitterClass = emitterInfo.GetProperty <string>("_class");
                if (ParticleControllerFactory.TryCreateEmitter(emitterClass, baseProperties, emitterInfo, out var emitter))
                {
                    emitters.Add(emitter);
                }
                else
                {
                    Console.WriteLine($"Unsupported emitter class '{emitterClass}'.");
                }
            }

            Emitters = emitters;
        }