static IEnumerable <Renderable> DrawZapWandering(WorldRenderer wr, PPos from, PPos to, Sequence s) { var z = float2.Zero; /* hack */ var dist = to - from; var norm = (1f / dist.Length) * new float2(-dist.Y, dist.X); var renderables = new List <Renderable>(); if (Game.CosmeticRandom.Next(2) != 0) { var p1 = from.ToFloat2() + (1 / 3f) * dist.ToFloat2() + Game.CosmeticRandom.Gauss1D(1) * .2f * dist.Length * norm; var p2 = from.ToFloat2() + (2 / 3f) * dist.ToFloat2() + Game.CosmeticRandom.Gauss1D(1) * .2f * dist.Length * norm; renderables.AddRange(DrawZap(wr, from.ToFloat2(), p1, s, out p1)); renderables.AddRange(DrawZap(wr, p1, p2, s, out p2)); renderables.AddRange(DrawZap(wr, p2, to.ToFloat2(), s, out z)); } else { var p1 = from.ToFloat2() + (1 / 2f) * dist.ToFloat2() + Game.CosmeticRandom.Gauss1D(1) * .2f * dist.Length * norm; renderables.AddRange(DrawZap(wr, from.ToFloat2(), p1, s, out p1)); renderables.AddRange(DrawZap(wr, p1, to.ToFloat2(), s, out z)); } return(renderables); }
public IEnumerable <Renderable> Render() { var pos = location.ToFloat2() - new float2(0, altitude); yield return(new Renderable(anim.Image, location.ToFloat2() - .5f * anim.Image.size, "shadow", 0)); yield return(new Renderable(anim.Image, pos - .5f * anim.Image.size, palette, 2)); yield return(new Renderable(paraAnim.Image, pos - .5f * paraAnim.Image.size + offset, palette, 3)); }
void Explode(World world) { world.AddFrameEndTask(w => w.Remove(this)); Combat.DoExplosion(firedBy.PlayerActor, weapon, pos, 0); world.WorldActor.Trait <ScreenShaker>().AddEffect(20, pos.ToFloat2(), 5); foreach (var a in world.ActorsWithTrait <NukePaletteEffect>()) { a.Trait.Enable(); } }
public IEnumerable <Renderable> Render(WorldRenderer wr) { var rc = cargo.Render(wr).Select(a => a.WithPos(a.Pos - new float2(0, altitude)) .WithZOffset(a.ZOffset + (int)altitude)); // Don't render anything if the cargo is invisible (e.g. under fog) if (!rc.Any()) { yield break; } foreach (var c in rc) { yield return(c.WithPos(location.ToFloat2() - .5f * c.Sprite.size).WithPalette(wr.Palette("shadow")).WithZOffset(0)); yield return(c.WithZOffset(2)); } var pos = location.ToFloat2() - new float2(0, altitude); yield return(new Renderable(paraAnim.Image, pos - .5f * paraAnim.Image.size + offset, rc.First().Palette, 3)); }
public void Render(WorldRenderer wr, World w, ActorInfo ai, PPos centerLocation) { var jamsMissiles = ai.Traits.GetOrDefault <JamsMissilesInfo>(); if (jamsMissiles != null) { RenderJammerCircle.DrawRangeCircle(wr, centerLocation.ToFloat2(), jamsMissiles.Range, Color.Red); } var jamsRadar = ai.Traits.GetOrDefault <JamsRadarInfo>(); if (jamsRadar != null) { RenderJammerCircle.DrawRangeCircle(wr, centerLocation.ToFloat2(), jamsRadar.Range, Color.Blue); } foreach (var a in w.ActorsWithTrait <RenderJammerCircle>()) { if (a.Actor.Owner == a.Actor.World.LocalPlayer) { a.Trait.RenderBeforeWorld(wr, a.Actor); } } }
public void Render(WorldRenderer wr, World w, ActorInfo ai, PPos centerLocation) { wr.DrawRangeCircle( Color.FromArgb(128, Color.Cyan), centerLocation.ToFloat2(), ai.Traits.Get <CreatesShroudInfo>().Range); foreach (var a in w.ActorsWithTrait <RenderShroudCircle>()) { if (a.Actor.Owner == a.Actor.World.LocalPlayer) { a.Trait.RenderBeforeWorld(wr, a.Actor); } } }
public void Render(WorldRenderer wr, World w, ActorInfo ai, PPos centerLocation) { wr.DrawRangeCircle( Color.FromArgb(128, Color.Yellow), centerLocation.ToFloat2(), ai.Traits.Get <AttackBaseInfo>().GetMaximumRange()); foreach (var a in w.ActorsWithTrait <RenderRangeCircle>()) { if (a.Actor.Owner == a.Actor.World.LocalPlayer) { if (a.Actor.Info.Traits.Get <RenderRangeCircleInfo>().RangeCircleType == RangeCircleType) { a.Trait.RenderBeforeWorld(wr, a.Actor); } } } }
public IEnumerable<Renderable> Render(WorldRenderer wr) { if (explosion != null) yield return new Renderable(explosion.Image, args.dest.ToFloat2() - .5f * explosion.Image.size, wr.Palette("effect"), (int)args.dest.Y); if (ticks >= info.BeamDuration) yield break; var rc = Color.FromArgb((info.BeamDuration - ticks)*255/info.BeamDuration, color); var src = new PPos(args.src.X, args.src.Y - args.srcAltitude); var dest = new PPos(args.dest.X, args.dest.Y - args.destAltitude); var wlr = Game.Renderer.WorldLineRenderer; wlr.LineWidth = info.BeamRadius * 2; wlr.DrawLine(src.ToFloat2(), dest.ToFloat2(), rc, rc); wlr.Flush(); wlr.LineWidth = 1f; }
public void Render(WorldRenderer wr, World w, ActorInfo ai, PPos centerLocation) { wr.DrawRangeCircleWithContrast( Color.FromArgb(128, Color.Yellow), centerLocation.ToFloat2(), ai.Traits.WithInterface <ArmamentInfo>() .Select(a => Rules.Weapons[a.Weapon.ToLowerInvariant()].Range).Max(), Color.FromArgb(96, Color.Black), 1 ); foreach (var a in w.ActorsWithTrait <RenderRangeCircle>()) { if (a.Actor.Owner == a.Actor.World.LocalPlayer) { if (a.Actor.Info.Traits.Get <RenderRangeCircleInfo>().RangeCircleType == RangeCircleType) { a.Trait.RenderBeforeWorld(wr, a.Actor); } } } }
public IEnumerable <Renderable> Render(WorldRenderer wr) { if (explosion != null) { yield return(new Renderable(explosion.Image, args.dest.ToFloat2() - .5f * explosion.Image.size, wr.Palette("effect"), (int)args.dest.Y)); } if (ticks >= info.BeamDuration) { yield break; } var rc = Color.FromArgb((info.BeamDuration - ticks) * 255 / info.BeamDuration, color); var src = new PPos(args.src.X, args.src.Y - args.srcAltitude); var dest = new PPos(args.dest.X, args.dest.Y - args.destAltitude); var wlr = Game.Renderer.WorldLineRenderer; wlr.LineWidth = info.BeamRadius * 2; wlr.DrawLine(src.ToFloat2(), dest.ToFloat2(), rc, rc); wlr.Flush(); wlr.LineWidth = 1f; }
static IEnumerable<Renderable> DrawZapWandering(WorldRenderer wr, PPos from, PPos to, Sequence s) { var z = float2.Zero; /* hack */ var dist = to - from; var norm = (1f / dist.Length) * new float2(-dist.Y, dist.X); var renderables = new List<Renderable>(); if (Game.CosmeticRandom.Next(2) != 0) { var p1 = from.ToFloat2() + (1 / 3f) * dist.ToFloat2() + Game.CosmeticRandom.Gauss1D(1) * .2f * dist.Length * norm; var p2 = from.ToFloat2() + (2 / 3f) * dist.ToFloat2() + Game.CosmeticRandom.Gauss1D(1) * .2f * dist.Length * norm; renderables.AddRange(DrawZap(wr, from.ToFloat2(), p1, s, out p1)); renderables.AddRange(DrawZap(wr, p1, p2, s, out p2)); renderables.AddRange(DrawZap(wr, p2, to.ToFloat2(), s, out z)); } else { var p1 = from.ToFloat2() + (1 / 2f) * dist.ToFloat2() + Game.CosmeticRandom.Gauss1D(1) * .2f * dist.Length * norm; renderables.AddRange(DrawZap(wr, from.ToFloat2(), p1, s, out p1)); renderables.AddRange(DrawZap(wr, p1, to.ToFloat2(), s, out z)); } return renderables; }
public IEnumerable <Renderable> Render() { yield return(new Renderable(anim.Image, pos.ToFloat2() - .5f * anim.Image.size, "effect", (int)pos.Y)); }
public IEnumerable <Renderable> Render() { font.DrawTextWithContrast(s, Game.viewport.Zoom * (pos.ToFloat2() - Game.viewport.Location) - offset, color, Color.Black, 1); yield break; }
public IEnumerable <Renderable> Render(WorldRenderer wr) { yield return(new Renderable(anim.Image, pos.ToFloat2() - .5f * anim.Image.size, wr.Palette("effect"), (int)pos.Y)); }
public IEnumerable <Renderable> Render() { yield return(new Renderable(anim.Image, pos.ToFloat2() - .5f * anim.Image.size - new int2(0, altitude), "effect", (int)pos.Y - altitude)); }