本文整理汇总了C#中ParticleEmitter.Update方法的典型用法代码示例。如果您正苦于以下问题:C# ParticleEmitter.Update方法的具体用法?C# ParticleEmitter.Update怎么用?C# ParticleEmitter.Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleEmitter
的用法示例。
在下文中一共展示了ParticleEmitter.Update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEmitter
public void TestEmitter()
{
var dummySystem = new ParticleSystem();
var emitter = new ParticleEmitter();
emitter.MaxParticlesOverride = 10;
emitter.ParticleLifetime = new Vector2(1, 1);
emitter.EmitParticles(5);
emitter.Update(0.016f, dummySystem);
Assert.That(emitter.LivingParticles, Is.EqualTo(5));
}
示例2: EmitterUpdate
public void EmitterUpdate()
{
var emitter = new ParticleEmitter();
var dummyParticleSystem = new ParticleSystem();
const float dt = 0.0166666666667f;
// Updating the emitter forces the creation of a default spawner (100 particles per second)
emitter.Update(dt, dummyParticleSystem);
var forceField = new UpdaterForceField();
emitter.Updaters.Add(forceField);
var positionSeed = new InitialPositionSeed();
emitter.Initializers.Add(positionSeed);
var velocitySeed = new InitialVelocitySeed();
emitter.Initializers.Add(velocitySeed);
// Fixed delta time for simulating 60 fps
var totalTime = 0f;
// Simulate 10 seconds
while (totalTime < 10)
{
emitter.Update(dt, dummyParticleSystem);
totalTime += dt;
}
emitter.Updaters.Remove(forceField);
// Simulate 10 seconds
while (totalTime < 10)
{
emitter.Update(dt, dummyParticleSystem);
totalTime += dt;
}
emitter.Initializers.Remove(positionSeed);
// Simulate 10 seconds
while (totalTime < 10)
{
emitter.Update(dt, dummyParticleSystem);
totalTime += dt;
}
emitter.Updaters.Add(forceField);
emitter.Initializers.Add(positionSeed);
// Simulate 10 seconds
while (totalTime < 10)
{
emitter.Update(dt, dummyParticleSystem);
totalTime += dt;
}
// The emitter update doesn't assert anything as the state of the particle system will be difficult to predict
// Such tests will be part of the GraphicsTests
}