本文整理汇总了C#中ParticleEmitter.Spawn方法的典型用法代码示例。如果您正苦于以下问题:C# ParticleEmitter.Spawn方法的具体用法?C# ParticleEmitter.Spawn怎么用?C# ParticleEmitter.Spawn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleEmitter
的用法示例。
在下文中一共展示了ParticleEmitter.Spawn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpawnOneBurst
public void SpawnOneBurst()
{
camera.Position = Vector3D.One / 2;
var emitterData = GetEmitterData(spark, 512);
emitterData.SpawnInterval = 0.0f;
var emitter = new ParticleEmitter(emitterData, Vector3D.Zero);
new Command(() => emitter.Spawn(64)).Add(new KeyTrigger(Key.Space));
}
示例2: TrackRotationOfEmitter
public void TrackRotationOfEmitter()
{
var emitterData = CreateTrackingParticleData();
emitterData.SpawnInterval = 0;
emitterData.BillboardMode = BillboardMode.Ground;
emitterData.LifeTime = 0.0f;
var emitter = new ParticleEmitter(emitterData, Vector3D.Zero);
emitter.Rotation = Quaternion.FromAxisAngle(Vector3D.UnitZ, 60);
AdvanceTimeAndUpdateEntities();
emitter.Spawn(1);
Assert.AreEqual(emitter.Rotation.CalculateAxisAngle(), emitter.particles[0].Rotation);
emitter.Rotation = Quaternion.FromAxisAngle(Vector3D.UnitZ, 90);
AdvanceTimeAndUpdateEntities();
Assert.AreEqual(emitter.Rotation.CalculateAxisAngle(), emitter.particles[0].Rotation);
}
示例3: FireOneBullet
public void FireOneBullet()
{
var emitterData = GetEmitterData(water, 512, 2.0f);
emitterData.SpawnInterval = 0.0f;
emitterData.Acceleration = new RangeGraph<Vector3D>(Vector3D.Zero, Vector3D.Zero);
emitterData.Color = new RangeGraph<Color>(new Color(255, 255, 255), new Color(255, 255, 255));
emitterData.Size = new RangeGraph<Size>(new Size(0.5f), new Size(0.5f));
var emitter = new ParticleEmitter(emitterData, Vector3D.Zero);
var enemy = new MockEnemy(new Vector3D(0, -3, 0), Size.Half, spark);
new Command(() => //ncrunch: no coverage start
{
emitter.EmitterData.BillboardMode = BillboardMode.Ground;
emitter.EmitterData.StartVelocity.Start = enemy.Position * 4.0f + enemy.direction * 0.5f;
emitter.EmitterData.StartVelocity.End = Vector3D.Zero;
emitter.Spawn();
}).Add(new KeyTrigger(Key.Space));
//ncrunch: no coverage end
}
示例4: TrackRotationOfEmitterVisually
public void TrackRotationOfEmitterVisually()
{
var emitterData = CreateTrackingParticleData();
emitterData.SpawnInterval = 0;
emitterData.BillboardMode = BillboardMode.Ground;
emitterData.LifeTime = 1.0f;
var emitter = new ParticleEmitter(emitterData, Vector3D.Zero);
new Command(Command.Click,
() => emitter.Rotation *= Quaternion.FromAxisAngle(Vector3D.UnitY, 30.0f)); //ncrunch: no coverage
new Command(Command.MiddleClick, () => emitter.Spawn(1));
}
示例5: TooManyParticlesThrowsError
public void TooManyParticlesThrowsError()
{
var emitterData = GetEmitterData(spark, ParticleEmitter.MaxParticles + 1);
var emitter = new ParticleEmitter(emitterData, Vector3D.Zero);
Assert.Throws<ParticleEmitter.MaximumNumberOfParticlesExceeded>(() => emitter.Spawn());
emitter.IsActive = false;
}