Move Contrail to Traits
And make interface implementations explicit while we're at it.
This commit is contained in:
@@ -134,7 +134,6 @@
|
|||||||
<Compile Include="AudioLoaders\VocLoader.cs" />
|
<Compile Include="AudioLoaders\VocLoader.cs" />
|
||||||
<Compile Include="AudioLoaders\WavLoader.cs" />
|
<Compile Include="AudioLoaders\WavLoader.cs" />
|
||||||
<Compile Include="Effects\Beacon.cs" />
|
<Compile Include="Effects\Beacon.cs" />
|
||||||
<Compile Include="Effects\Contrail.cs" />
|
|
||||||
<Compile Include="Effects\ContrailFader.cs" />
|
<Compile Include="Effects\ContrailFader.cs" />
|
||||||
<Compile Include="Effects\CrateEffect.cs" />
|
<Compile Include="Effects\CrateEffect.cs" />
|
||||||
<Compile Include="Effects\RevealShroudEffect.cs" />
|
<Compile Include="Effects\RevealShroudEffect.cs" />
|
||||||
@@ -295,6 +294,7 @@
|
|||||||
<Compile Include="Traits\Burns.cs" />
|
<Compile Include="Traits\Burns.cs" />
|
||||||
<Compile Include="Traits\ChangesTerrain.cs" />
|
<Compile Include="Traits\ChangesTerrain.cs" />
|
||||||
<Compile Include="Traits\CommandBarBlacklist.cs" />
|
<Compile Include="Traits\CommandBarBlacklist.cs" />
|
||||||
|
<Compile Include="Traits\Contrail.cs" />
|
||||||
<Compile Include="Traits\Health.cs" />
|
<Compile Include="Traits\Health.cs" />
|
||||||
<Compile Include="Traits\HitShape.cs" />
|
<Compile Include="Traits\HitShape.cs" />
|
||||||
<Compile Include="Traits\Player\DeveloperMode.cs" />
|
<Compile Include="Traits\Player\DeveloperMode.cs" />
|
||||||
|
|||||||
@@ -13,10 +13,9 @@ using System.Collections.Generic;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.Common.Graphics;
|
using OpenRA.Mods.Common.Graphics;
|
||||||
using OpenRA.Mods.Common.Traits;
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Effects
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Draw a colored contrail behind this actor when they move.")]
|
[Desc("Draw a colored contrail behind this actor when they move.")]
|
||||||
class ContrailInfo : ITraitInfo, Requires<BodyOrientationInfo>
|
class ContrailInfo : ITraitInfo, Requires<BodyOrientationInfo>
|
||||||
@@ -61,18 +60,18 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
body = self.Trait<BodyOrientation>();
|
body = self.Trait<BodyOrientation>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
void ITick.Tick(Actor self)
|
||||||
{
|
{
|
||||||
var local = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation));
|
var local = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation));
|
||||||
trail.Update(self.CenterPosition + body.LocalToWorld(local));
|
trail.Update(self.CenterPosition + body.LocalToWorld(local));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IRenderable> Render(Actor self, WorldRenderer wr)
|
IEnumerable<IRenderable> IRender.Render(Actor self, WorldRenderer wr)
|
||||||
{
|
{
|
||||||
return new IRenderable[] { trail };
|
return new IRenderable[] { trail };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddedToWorld(Actor self)
|
void INotifyAddedToWorld.AddedToWorld(Actor self)
|
||||||
{
|
{
|
||||||
trail = new ContrailRenderable(self.World, color, info.TrailWidth, info.TrailLength, 0, info.ZOffset);
|
trail = new ContrailRenderable(self.World, color, info.TrailWidth, info.TrailLength, 0, info.ZOffset);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user