Merge pull request #12062 from abc013/VoxelShadows
Added a flag ShowShadow in WithVoxelBarrel, WithVoxelBody, …
This commit is contained in:
@@ -29,6 +29,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
[Desc("Visual offset")]
|
||||
public readonly WVec LocalOffset = WVec.Zero;
|
||||
|
||||
[Desc("Defines if the Voxel should have a shadow.")]
|
||||
public readonly bool ShowShadow = true;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new WithVoxelBarrel(init.Self, this); }
|
||||
|
||||
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
|
||||
@@ -53,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
Func<WVec> barrelOffset = () => body.LocalToWorld((t.Offset + LocalOffset.Rotate(quantizedTurret())).Rotate(quantizedBody()));
|
||||
|
||||
yield return new VoxelAnimation(voxel, barrelOffset, () => new[] { turretOrientation(), orientation() },
|
||||
() => false, () => 0);
|
||||
() => false, () => 0, ShowShadow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +85,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var rv = self.Trait<RenderVoxels>();
|
||||
rv.Add(new VoxelAnimation(VoxelProvider.GetVoxel(rv.Image, Info.Sequence),
|
||||
BarrelOffset, BarrelRotation,
|
||||
() => IsTraitDisabled || !buildComplete, () => 0));
|
||||
() => IsTraitDisabled || !buildComplete, () => 0, info.ShowShadow));
|
||||
}
|
||||
|
||||
WVec BarrelOffset()
|
||||
|
||||
@@ -23,6 +23,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
{
|
||||
public readonly string Sequence = "idle";
|
||||
|
||||
[Desc("Defines if the Voxel should have a shadow.")]
|
||||
public readonly bool ShowShadow = true;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new WithVoxelBody(init.Self, this); }
|
||||
|
||||
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
|
||||
@@ -32,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var voxel = VoxelProvider.GetVoxel(image, "idle");
|
||||
yield return new VoxelAnimation(voxel, () => WVec.Zero,
|
||||
() => new[] { body.QuantizeOrientation(orientation(), facings) },
|
||||
() => false, () => 0);
|
||||
() => false, () => 0, ShowShadow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var voxel = VoxelProvider.GetVoxel(rv.Image, info.Sequence);
|
||||
rv.Add(new VoxelAnimation(voxel, () => WVec.Zero,
|
||||
() => new[] { body.QuantizeOrientation(self, self.Orientation) },
|
||||
() => IsTraitDisabled, () => 0));
|
||||
() => IsTraitDisabled, () => 0, info.ShowShadow));
|
||||
|
||||
// Selection size
|
||||
var rvi = self.Info.TraitInfo<RenderVoxelsInfo>();
|
||||
|
||||
@@ -26,6 +26,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
[Desc("Turreted 'Turret' key to display")]
|
||||
public readonly string Turret = "primary";
|
||||
|
||||
[Desc("Defines if the Voxel should have a shadow.")]
|
||||
public readonly bool ShowShadow = true;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new WithVoxelTurret(init.Self, this); }
|
||||
|
||||
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
|
||||
@@ -44,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var turretFacing = Turreted.TurretFacingFromInit(init, t.InitialFacing, Turret);
|
||||
Func<WRot> turretBodyOrientation = () => WRot.FromYaw(WAngle.FromFacing(turretFacing()) - orientation().Yaw);
|
||||
yield return new VoxelAnimation(voxel, turretOffset,
|
||||
() => new[] { turretBodyOrientation(), body.QuantizeOrientation(orientation(), facings) }, () => false, () => 0);
|
||||
() => new[] { turretBodyOrientation(), body.QuantizeOrientation(orientation(), facings) }, () => false, () => 0, ShowShadow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var rv = self.Trait<RenderVoxels>();
|
||||
rv.Add(new VoxelAnimation(VoxelProvider.GetVoxel(rv.Image, Info.Sequence),
|
||||
() => turreted.Position(self), TurretRotation,
|
||||
() => IsTraitDisabled || !buildComplete, () => 0));
|
||||
() => IsTraitDisabled || !buildComplete, () => 0, info.ShowShadow));
|
||||
}
|
||||
|
||||
IEnumerable<WRot> TurretRotation()
|
||||
|
||||
Reference in New Issue
Block a user