Example #1
0
        public Beams(IEffectApi effectApi, int width, int height) : base(width, height)
        {
            _api            = effectApi;
            _render         = _api.CreateRender();
            _particleSystem = _api.CreateParticleSystem();

            _color         = new SKColor(0, 128, 128);
            _particleSpeed = 5;
            _particleSize  = 4;
        }
Example #2
0
        public Sparkles(IEffectApi effectApi, int width, int height) : base(width, height)
        {
            _api = effectApi;

            // Create a render for this effect instance once.
            _render = _api.CreateRender();

            // Create a particle system
            _particleSystem = _api.CreateParticleSystem();

            _color        = new SKColor(0, 128, 128);
            _numParticles = 3 * Width / 4;
            _particleSize = 1;
        }
Example #3
0
        public SparkleExplosion(IEffectApi api, int width, int height) : base(width, height)
        {
            _api = api;

            // Create a render for this effect instance once.
            _render = _api.CreateRender();

            // Create a particle system
            _particleSystem = _api.CreateParticleSystem();

            _random       = new Random();
            _color        = new SKColor(0, 255, 128);
            _numParticles = Width * Height * 0.25f;
            _particleSize = 2;
        }
Example #4
0
        public Fire(IEffectApi effectApi, int width, int height) : base(width, height)
        {
            _api            = effectApi;
            _render         = _api.CreateRender();
            _particleSystem = _api.CreateParticleSystem();

            _beginColor = new SKColor(128, 64, 16);
            var endColor = new SKColor(64, 64, 64);

            _particleEmitters = new List <IParticleEmitter>();

            int numEmbers = Math.Max((int)(Width / EmberDistance), 1);

            for (int i = 0; i < numEmbers; i++)
            {
                var xPos = Width / (numEmbers - 1f) * i;
                var yPos = Height;

                var emitterConfig = new ParticleEmitterConfig
                {
                    Position               = new Vector2(xPos, yPos),
                    AxisPosition           = new Vector2(xPos, yPos),
                    EmissionRate           = 8,
                    Angle                  = new Range <float>(45, 135),
                    Life                   = 4,
                    Speed                  = 4,
                    RadialAcceleration     = 0,
                    TangentialAcceleration = 0,
                    BeginColor             = _beginColor,
                    EndColor               = endColor,
                    BeginSize              = 4,
                    EndSize                = 4,
                    EnableSizeTransition   = true,
                    EnableColorTransition  = true,
                };

                var emitter = _particleSystem.AddEmitter(emitterConfig);
                _particleEmitters.Add(emitter);
            }
        }