コード例 #1
0
        public void ParticleRateLargerMaxBurstRunsOnce(int milliseconds)
        {
            var dt = TimeSpan.FromMilliseconds(milliseconds);

            var totalCreated = 0;
            var totalInvoke  = 0;

            var emitter = new SKConfettiEmitter(100, 200, 0);

            emitter.ParticlesCreated += count =>
            {
                totalCreated += count;
                totalInvoke++;
            };

            emitter.Update(dt);

            Assert.Equal(100, totalCreated);
            Assert.Equal(1, totalInvoke);
            Assert.True(emitter.IsComplete);

            emitter.Update(dt);

            Assert.Equal(100, totalCreated);
            Assert.Equal(1, totalInvoke);
            Assert.True(emitter.IsComplete);
        }
コード例 #2
0
        public void ParticleRateNoMaxOneMin(int milliseconds, int expectedCreated, int expectedCreated2, bool complete, bool complete2)
        {
            var dt = TimeSpan.FromMilliseconds(milliseconds);

            var totalCreated = 0;
            var totalInvoke  = 0;

            var emitter = new SKConfettiEmitter(100, -1, 1.0);

            emitter.ParticlesCreated += count =>
            {
                totalCreated += count;
                totalInvoke++;
            };

            emitter.Update(dt);

            Assert.Equal(expectedCreated, totalCreated);
            Assert.Equal(1, totalInvoke);
            Assert.Equal(complete, emitter.IsComplete);

            emitter.Update(dt);

            Assert.Equal(expectedCreated2, totalCreated);
            if (complete)
            {
                Assert.Equal(1, totalInvoke);
            }
            else
            {
                Assert.Equal(2, totalInvoke);
            }
            Assert.Equal(complete2, emitter.IsComplete);
        }