public void TestShieldEffect() { r.SetCameraPosition(new Vector3(0, 0, 5), new Vector3(0, 0, 0)); var playbackSpeed = 0.3f; var effect = r.CreateParticleEffect(); var emitter = effect.CreateCustomEmitter(1 / 300f / playbackSpeed, p => { p.StartPosition = new Vector3(sampler.RandomPointOnCircle(), 0) * 0.1f; p.StartVelocity = new Vector3(sampler.RandomPointOnCircle(), 0); p.Size = 0.05f; p.Duration = 1 / 3f / playbackSpeed; }); effect.CalculatePosition = p => { var lifeTime = (effect.CurrentTime - p.SpawnTime) * 3 * playbackSpeed; var magicNumber = 0.4f; var startAngle = p.StartVelocity.X * 1000; var endAngle = p.StartVelocity.Y * 1000 % magicNumber + (1 - magicNumber); var ret = p.StartPosition; ret.X += (float)Math.Pow(lifeTime, 0.8f) * (float)Math.Cos(Math.Sqrt(lifeTime * 10 * endAngle) + startAngle); ret.Y += (float)Math.Pow(lifeTime, 0.8f) * (float)Math.Sin(Math.Sqrt(lifeTime * 10 * endAngle) + startAngle); ret.Z += ret.TakeXY().Length() * 0.5f; return(ret); }; loopEffect(() => { emitter.Start(); }, () => { emitter.Stop(); }); }
public BeamSpellEffect(ParticleEffect effect, GeometrySampler sampler) { this.effect = effect; this.sampler = sampler; emitter = effect.CreateCustomEmitter(1 / 100f, p => { p.StartPosition = seeder.NextFloat(0, 0.3f) * new Vector3(sampler.RandomPointOnCircle(), 0); p.Color = new Color4(1, 0, 0); p.Size = 0.1f; p.StartVelocity = new Vector3(0, 0, seeder.NextFloat(-1, -1)) * 50; p.Duration = 1f; }); }
public void TestCircle() { test.SetCameraPosition(new Vector3(0, 0, 3), new Vector3()); displaySamples(1000, () => new Vector3(s.RandomPointOnCircle(), 0)); }