Beispiel #1
0
        public Particle(World world, ParticleInit init) : base(init.Position, init.Type.GetRenderable())
        {
            this.world = world;
            Type       = init.Type;

            Height = init.Height;

            current  = init.Convert("Duration", Type.Duration);
            dissolve = init.Convert("DissolveDuration", Type.DissolveDuration);

            velocity        = init.Convert("Velocity", ParticleUtils.Variety(Type.RandomVelocity));
            rotate_velocity = init.Convert("RotationVelocity", ParticleUtils.AngleVariety(Type.RandomRotation));

            // Set invisible first and check later for visibility
            Visible = false;
        }
        public BatchRenderable GetRenderable()
        {
            var color = Color + ParticleUtils.Variety(ColorVariety);

            if (Texture == null)
            {
                var renderable = new BatchObject(MeshSize * MasterRenderer.PixelMultiplier + ParticleUtils.Variety(MeshSizeVariety));
                renderable.SetColor(color);
                return(renderable);
            }

            var sequence = new BatchSequence(Texture);

            sequence.SetColor(color);
            return(sequence);
        }