Exemple #1
0
        public static EmitterSimple NewEmitter(RoomScene room, Atlas atlas, string spriteName, Vector2 pos, Vector2 vel, float gravity, int frameEnd, int fadeStart = 0, float alphaStart = 1, float alphaEnd = 0)
        {
            // Retrieve an emitter from the pool.
            EmitterSimple emitter = EmitterSimple.emitterPool.GetObject();

            emitter.atlas      = atlas;
            emitter.spriteName = spriteName;
            emitter.gravity    = gravity;
            emitter.pos        = pos;
            emitter.vel        = vel;
            emitter.frameEnd   = frameEnd;
            emitter.fadeStart  = fadeStart == 0 ? frameEnd + 1 : fadeStart;
            emitter.alphaStart = alphaStart;
            emitter.alphaEnd   = alphaEnd;

            emitter.particles = new List <ParticleStandard>();

            // Add the Emitter to the Particle Handler
            room.particleHandler.AddEmitter(emitter);

            return(emitter);
        }
Exemple #2
0
        public static ParticleFree SetParticle(RoomScene room, Atlas atlas, string spriteName, Vector2 pos, Vector2 vel, int frameEnd, int fadeStart = 0, float alphaStart = 1, float alphaEnd = 0, float rotation = 0, float rotationSpeed = 0, float gravity = 0)
        {
            // Retrieve an available particle from the pool.
            ParticleFree particle = ParticleFree.pool.GetObject();

            particle.atlas         = atlas;
            particle.spriteName    = spriteName;
            particle.gravity       = gravity;
            particle.pos           = pos;
            particle.vel           = vel;
            particle.frameEnd      = frameEnd;
            particle.fadeStart     = fadeStart == 0 ? frameEnd + 1 : fadeStart;
            particle.alphaStart    = alphaStart;
            particle.alphaEnd      = alphaEnd;
            particle.rotation      = rotation;
            particle.rotationSpeed = rotationSpeed;

            // Add the Particle to the Particle Handler
            room.particleHandler.AddParticle(particle);

            return(particle);
        }