Example #1
0
        public void Test0()
        {
            var ps        = new ParticleSystem();
            var direction = ps.Parameters.AddUniform <float>("D");

            var e = new StartValueEffector <float>
            {
                ParticleSystem = ps,
                Parameter      = "D",
            };

            var dt = new TimeSpan(0, 0, 0, 1);

            e.RequeryParameters();
            e.Initialize();
            e.BeginUpdate(dt);
            e.UpdateParticles(dt, 10, 20);
            e.EndUpdate(dt);

            Assert.AreEqual(0, direction.DefaultValue);

            e.Distribution = new ConstValueDistribution <float>(23);

            e.Initialize();
            e.BeginUpdate(dt);
            e.UpdateParticles(dt, 10, 20);
            e.EndUpdate(dt);

            Assert.AreEqual(23, direction.DefaultValue);
        }
        public void Test1()
        {
            var ps = new ParticleSystem();
              var direction = ps.Parameters.AddVarying<float>("D");

              var e = new StartValueEffector<float>
              {
            ParticleSystem = ps,
            Parameter = "D",
              };

              var dt = new TimeSpan(0, 0, 0, 1);

              e.RequeryParameters();
              e.Initialize();
              e.InitializeParticles(10, 20, null);
              e.BeginUpdate(dt);
              e.UpdateParticles(dt, 10, 20);
              e.EndUpdate(dt);

              Assert.AreEqual(0, direction.Values[11]);

              e.Distribution = new ConstValueDistribution<float>(23);

              e.Initialize();
              e.InitializeParticles(10, 20, null);
              e.BeginUpdate(dt);
              e.UpdateParticles(dt, 10, 20);
              e.EndUpdate(dt);

              Assert.AreEqual(23, direction.Values[11]);
        }
Example #3
0
        public void WrongParameters()
        {
            var ps = new ParticleSystem();

            ps.Parameters.AddUniform <float>("D");

            var e = new StartValueEffector <float> {
                ParticleSystem = ps
            };

            var dt = new TimeSpan(0, 0, 0, 1);

            // There should be no exception.
            e.RequeryParameters();
            e.Initialize();
            e.BeginUpdate(dt);
            e.UpdateParticles(dt, 10, 20);
            e.EndUpdate(dt);

            e.Uninitialize();
        }
        public void WrongParameters()
        {
            var ps = new ParticleSystem();
              ps.Parameters.AddUniform<float>("D");

              var e = new StartValueEffector<float> { ParticleSystem = ps };

              var dt = new TimeSpan(0, 0, 0, 1);

              // There should be no exception.
              e.RequeryParameters();
              e.Initialize();
              e.BeginUpdate(dt);
              e.UpdateParticles(dt, 10, 20);
              e.EndUpdate(dt);

              e.Uninitialize();
        }