Overhaul LazerZap and AreaBeam rendering.

This commit is contained in:
Paul Chote
2015-11-29 11:49:01 +00:00
parent 78556ec60c
commit 92d0261005
7 changed files with 53 additions and 21 deletions

View File

@@ -35,6 +35,9 @@ namespace OpenRA.Mods.Common.Effects
[Desc("The width of the beam.")]
public readonly WDist Width = new WDist(512);
[Desc("The shape of the beam. Accepts values Cylindrical or Flat.")]
public readonly BeamRenderableShape Shape = BeamRenderableShape.Cylindrical;
[Desc("How far beyond the target the projectile keeps on travelling.")]
public readonly WDist BeyondTargetRange = new WDist(0);
@@ -190,9 +193,7 @@ namespace OpenRA.Mods.Common.Effects
{
if (!IsBeamComplete && info.RenderBeam && !(wr.World.FogObscures(tailPos) && wr.World.FogObscures(headPos)))
{
float width, y, z;
wr.ScreenVectorComponents(new WVec(info.Width, WDist.Zero, WDist.Zero), out width, out y, out z);
var beamRender = new BeamRenderable(headPos, 0, tailPos - headPos, width, color);
var beamRender = new BeamRenderable(headPos, 0, tailPos - headPos, info.Shape, info.Width, color);
return new[] { (IRenderable)beamRender };
}

View File

@@ -21,7 +21,11 @@ namespace OpenRA.Mods.Common.Effects
[Desc("Not a sprite, but an engine effect.")]
class LaserZapInfo : IProjectileInfo
{
public readonly int BeamWidth = 2;
[Desc("The width of the zap.")]
public readonly WDist Width = new WDist(86);
[Desc("The shape of the beam. Accepts values Cylindrical or Flat.")]
public readonly BeamRenderableShape Shape = BeamRenderableShape.Cylindrical;
public readonly int BeamDuration = 10;
@@ -98,7 +102,7 @@ namespace OpenRA.Mods.Common.Effects
if (ticks < info.BeamDuration)
{
var rc = Color.FromArgb((info.BeamDuration - ticks) * 255 / info.BeamDuration, color);
yield return new BeamRenderable(args.Source, 0, target - args.Source, info.BeamWidth, rc);
yield return new BeamRenderable(args.Source, 0, target - args.Source, info.Shape, info.Width, rc);
}
if (hitanim != null)