Beispiel #1
0
        public void Returns_Value_Between_Min_And_Max_On_Invocation()
        {
            const int seed    = 1;
            var       trigger = new OneShotTrigger(new Random(seed))
            {
                MinParticlesToEmit = 5,
                MaxParticlesToEmit = 10,
            };

            var allocator = new ParticleAllocator(10);
            var config    = new EmitterConfig
            {
                Trigger         = trigger,
                InitialCapacity = 10,
            };

            var emitter = new ParticleEmitter(allocator, config);

            var result = trigger.DetermineNumberOfParticlesToCreate(emitter, 0.16f);

            result.ShouldBe(new Random(seed).Next(trigger.MinParticlesToEmit, trigger.MaxParticlesToEmit + 1));
        }
Beispiel #2
0
        public void Turns_Emitter_Off_After_Trigger_Runs()
        {
            var trigger = new OneShotTrigger(new Random())
            {
                MinParticlesToEmit = 5,
                MaxParticlesToEmit = 10,
            };

            var allocator = new ParticleAllocator(10);
            var config    = new EmitterConfig
            {
                Trigger         = trigger,
                InitialCapacity = 10,
            };

            var emitter = new ParticleEmitter(allocator, config)
            {
                IsEmittingNewParticles = true,
            };

            trigger.DetermineNumberOfParticlesToCreate(emitter, 0.16f);

            emitter.IsEmittingNewParticles.ShouldBeFalse();
        }