コード例 #1
0
        public static void SpawnRainDrop(Vector2f position, Vector2f velocity, ParticleProperties props)
        {
            CheckInitialized();

            Shape newShape = new RectangleShape(new Vector2f(props.sizeSingle, 5));
            //newShape.Rotation = 20.0f * (float)(Math.PI * Math.Atan(velocity.Y / velocity.X));
            Color newColor = props.col;

            newColor.A         = 100;
            newShape.FillColor = newColor;

            ShapeParticle particle = new ShapeParticle(newShape, props.lifeTime, position, velocity);

            particle.FrictionCoefficient = 1.0f - 0.01f * (float)RandomGenerator.Random.NextDouble();
            particle.AlphaChangeType     = PennerDoubleAnimation.EquationType.None;
            particle.AffectedByGravity   = props.AffectedByGravity;
            particle.RotationType        = props.RotationType;
            _particleList.Add(particle);
        }
コード例 #2
0
        public static void SpawnSmokePuff(Vector2f position, Vector2f velocity, Color col, float smokePuffSize, float lifeTime = 1.5f)
        {
            CheckInitialized();
            Shape newShape = new CircleShape(smokePuffSize);

            newShape.Origin = new Vector2f(smokePuffSize / 2.0f, smokePuffSize / 2.0f);
            Color newColor = col;

            newColor.A         = 25;
            newShape.FillColor = newColor;

            ShapeParticle particle = new ShapeParticle(
                newShape,
                lifeTime * (0.25f + (float)RandomGenerator.Random.NextDouble() + 0.5f),
                position, velocity);

            particle.FrictionCoefficient = 0.98f;
            _particleList.Add(particle);
        }
コード例 #3
0
        public static void SpawnSingleDebris(Vector2f position, Vector2f velocity, Color col, float size, float lifeTime = 0.5f)
        {
            CheckInitialized();

            Shape newShape = new RectangleShape(new Vector2f(size * 1.5f, size * 0.4f));

            newShape.Origin   = new Vector2f(size / 2.0f, size / 2.0f);
            newShape.Rotation = 20.0f * (float)(Math.PI * Math.Atan(velocity.Y / velocity.X));
            Color newColor = col;

            newColor.A         = 125;
            newShape.FillColor = newColor;

            ShapeParticle particle = new ShapeParticle(newShape, lifeTime * ((float)RandomGenerator.Random.NextDouble() + 0.25f), position, velocity);

            particle.FrictionCoefficient = 0.9f;
            particle.AlphaChangeType     = PennerDoubleAnimation.EquationType.QuintEaseIn;
            particle.AffectedByGravity   = true;
            particle.RotationType        = ParticleRotationType.PRT_Velocity;
            _particleList.Add(particle);
        }