public ParticleEffect AddEffect(ParticleEffectType type, Func<ParticleEffect, Location> start, Func<ParticleEffect, Location> end, Func<ParticleEffect, float> fdata, float ttl, Location color, Location color2, bool fades, Texture texture, float salpha = 1) { ParticleEffect pe = new ParticleEffect(TheClient) { Type = type, Start = start, End = end, FData = fdata, TTL = ttl, O_TTL = ttl, Color = color, Color2 = color2, Alpha = salpha, Fades = fades, texture = texture }; ActiveEffects.Add(pe); return pe; }
public static float FadeInOut(ParticleEffect pe) { float rel = pe.TTL / pe.O_TTL; if (rel >= 0.5) { return 1 - ((rel - 0.5f) * 2); } else { return rel * 2; } }
public void FireSimple(Location pos, float sizemult) { Location colOne = new Location(3.0, 3.0, 2.0); Location colTwo = new Location(3.0, 2.0, 1.5); Location temp = new Location(0, 0, -TheClient.TheRegion.PhysicsWorld.ForceUpdater.Gravity.Z * 0.3f * sizemult); ParticleEffect pe = Engine.AddEffect(ParticleEffectType.SQUARE, (o) => pos + temp * (1 - o.TTL / o.O_TTL), (o) => new Location((o.TTL / o.O_TTL) * 2.0f), (o) => 0, sizemult * 2.0f, colOne, colTwo, true, FlameLick[Utilities.UtilRandom.Next() % FlameLick.Length]); pe.AltAlpha = ParticleEffect.InstantInSlowOutHalf; pe.OnDestroy = (o) => { if (Utilities.UtilRandom.Next(5) == 1) { Smoke(o.Start(o) - new Location(0, 0, 1), 1, Location.One); } }; }
public void DenseFire(Location pos, float sizemult) { double rando = Utilities.UtilRandom.NextDouble() * 1.0 + 2.0; Location colOne = new Location(rando, rando, 2.0); Location colTwo = new Location(rando, rando - 1.0, 1.5); Location temp = new Location(0, 0, -TheClient.TheRegion.PhysicsWorld.ForceUpdater.Gravity.Z * 0.3f * sizemult); ParticleEffect pe = Engine.AddEffect(ParticleEffectType.SQUARE, (o) => pos + temp * (1 - o.TTL / o.O_TTL), (o) => new Location((o.TTL / o.O_TTL)), (o) => 0, sizemult, colOne, colTwo, true, FireTriangle); pe.AltAlpha = ParticleEffect.InstantInSlowOutHalf; pe.OnDestroy = (o) => { if (Utilities.UtilRandom.Next(5) == 1) { Smoke(o.Start(o) - new Location(0, 0, 1), 1, Location.One); } }; }
public void Firework(Location pos, float rad, int lod, Location color, Location color2) { Location temp = new Location(TheClient.TheRegion.PhysicsWorld.ForceUpdater.Gravity * 0.1f); Location size = new Location(0.3); for (int i = 0; i < lod; i++) { Location col = color; if (col.X < 0) { col.X = Utilities.UtilRandom.NextDouble(); } if (col.Y < 0) { col.Y = Math.Max(Utilities.UtilRandom.NextDouble() - col.X * 0.25, 0.0); } if (col.Z < 0) { col.Z = Math.Max(Utilities.UtilRandom.NextDouble() - col.X * 0.25 - col.Y * 0.25, 0.0); } Location col2 = color2; if (col2.X < 0) { col2.X = Utilities.UtilRandom.NextDouble(); } if (col2.Y < 0) { col2.Y = Math.Max(Utilities.UtilRandom.NextDouble() - col2.X * 0.25, 0.0); } if (col2.Z < 0) { col2.Z = Math.Max(Utilities.UtilRandom.NextDouble() - col2.X * 0.25 - col2.Y * 0.25, 0.0); } Location speed = new Location(Utilities.UtilRandom.NextDouble() * (rad * 2) - rad, Utilities.UtilRandom.NextDouble() * (rad * 2) - rad, Utilities.UtilRandom.NextDouble() * (rad * 2) - rad) * 3.0; ParticleEffect pe = Engine.AddEffect(ParticleEffectType.SQUARE, (o) => pos + (temp + speed) * (1 - o.TTL / o.O_TTL), (o) => size, (o) => 0, 8, col, col2, true, Utilities.UtilRandom.Next(1000) < 500 ? Circle_Light : Circle_Heavy); pe.WindMod = 0.1f; } }
public static float QuickInSlowOutHalf(ParticleEffect pe) { return(QuickInSlowOut(pe) * 0.5f); }
public static float QuickInSlowOutWeak(ParticleEffect pe) { return(QuickInSlowOut(pe) * 0.75f); }
public static float InstantInSlowOutHalf(ParticleEffect pe) { return(InstantInSlowOut(pe) * 0.5f); }
public static float InstantInSlowOutWeak(ParticleEffect pe) { return(InstantInSlowOut(pe) * 0.75f); }
public static float FadeInOutHalf(ParticleEffect pe) { return(FadeInOut(pe) * 0.5f); }