Exemplo n.º 1
0
        public virtual void CreateJumpParticles()
        {
            var left = 0;

            for (var i = 0; i < 8; i++)
            {
                int side = 1;
                if (left < 3)
                {
                    side = -1;
                    left++;
                }

                var position = new Vector2(BoundingRectangle.Center.X, BoundingRectangle.Bottom);
                position.X += _rand.Next(5, 11) * side;
                var velocity = new Vector2(_rand.NextFloat(6f, 9f) * side, _rand.NextFloat(-4f, -9f)) * 3f;
                var size     = new Vector2(_rand.NextFloat(4f, 7f), _rand.NextFloat(3f, 6f));

                var state = new ParticleState()
                {
                    Velocity          = velocity,
                    AlphaBase         = _rand.NextFloat(0.2f, 0.4f),
                    Type              = ParticleType.Smoke,
                    UseCustomVelocity = true
                };

                SceneManager.Instance.ParticleManager.CreateParticle(ImageManager.loadParticle("Smoke"), position, Color.White, 800f, size, state);
            }
        }
Exemplo n.º 2
0
        private void CreateConfettiParticles(Vector2 position, int signal)
        {
            var texture = ImageManager.loadParticle("WhitePoint");

            for (var i = 0; i < _rand.Next(2, 5); i++)
            {
                var velocity = new Vector2(_rand.NextFloat(10f, 100f) * signal, _rand.NextFloat(-220f, -100f));
                var color    = ColorUtil.HSVToColor(MathHelper.ToRadians(_rand.NextFloat(0, 359)), 0.6f, 0.95f);
                var scale    = _rand.Next(0, 2) == 0 ? new Vector2(2, 2) : new Vector2(3, 3);

                var state = new ParticleState()
                {
                    Velocity           = velocity,
                    Type               = ParticleType.Confetti,
                    Gravity            = 1.8f,
                    UseCustomVelocity  = true,
                    VelocityMultiplier = 0.95f
                };

                SceneManager.Instance.ParticleManager.CreateParticle(texture, position, color, 800f, scale, state);
            }
        }