Exemple #1
0
        public void TestCoalescability()
        {
            MovementAffector <SimpleParticle> affector = new MovementAffector <SimpleParticle>(
                SimpleParticleModifier.Default
                );

            Assert.IsFalse(affector.IsCoalescable);
        }
Exemple #2
0
        public void TestConstructor()
        {
            MovementAffector <SimpleParticle> affector = new MovementAffector <SimpleParticle>(
                SimpleParticleModifier.Default
                );

            Assert.IsNotNull(affector); // nonsense; avoids compiler warning
        }
Exemple #3
0
        public void TestMovement()
        {
            MovementAffector <SimpleParticle> affector = new MovementAffector <SimpleParticle>(
                SimpleParticleModifier.Default
                );

            SimpleParticle[] /*100*/ particles = new SimpleParticle[100];
            particles[0].Velocity    = Vector3.One;
            particles[25].Velocity.X = 1.2f;
            particles[50].Velocity.Y = 3.4f;
            particles[75].Velocity.Z = 5.6f;
            particles[99].Velocity   = -Vector3.One;

            affector.Affect(particles, 20, 60, 1);

            for (int index = 0; index < 100; ++index)
            {
                switch (index)
                {
                case 25: {
                    Assert.AreEqual(new Vector3(1.2f, 0.0f, 0.0f), particles[index].Position);
                    break;
                }

                case 50: {
                    Assert.AreEqual(new Vector3(0.0f, 3.4f, 0.0f), particles[index].Position);
                    break;
                }

                case 75: {
                    Assert.AreEqual(new Vector3(0.0f, 0.0f, 5.6f), particles[index].Position);
                    break;
                }

                default: {
                    Assert.AreEqual(Vector3.Zero, particles[index].Position);
                    break;
                }
                }
            }
        }