Move Contrail to Traits

And make interface implementations explicit while we're at it.
This commit is contained in:
reaperrr
2017-09-04 19:38:29 +02:00
committed by Paul Chote
parent 898ef8fe50
commit 024887b268
2 changed files with 5 additions and 6 deletions

View File

@@ -134,7 +134,6 @@
<Compile Include="AudioLoaders\VocLoader.cs" />
<Compile Include="AudioLoaders\WavLoader.cs" />
<Compile Include="Effects\Beacon.cs" />
<Compile Include="Effects\Contrail.cs" />
<Compile Include="Effects\ContrailFader.cs" />
<Compile Include="Effects\CrateEffect.cs" />
<Compile Include="Effects\RevealShroudEffect.cs" />
@@ -295,6 +294,7 @@
<Compile Include="Traits\Burns.cs" />
<Compile Include="Traits\ChangesTerrain.cs" />
<Compile Include="Traits\CommandBarBlacklist.cs" />
<Compile Include="Traits\Contrail.cs" />
<Compile Include="Traits\Health.cs" />
<Compile Include="Traits\HitShape.cs" />
<Compile Include="Traits\Player\DeveloperMode.cs" />

View File

@@ -13,10 +13,9 @@ using System.Collections.Generic;
using System.Drawing;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Graphics;
using OpenRA.Mods.Common.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.")]
class ContrailInfo : ITraitInfo, Requires<BodyOrientationInfo>
@@ -61,18 +60,18 @@ namespace OpenRA.Mods.Common.Effects
body = self.Trait<BodyOrientation>();
}
public void Tick(Actor self)
void ITick.Tick(Actor self)
{
var local = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation));
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 };
}
public void AddedToWorld(Actor self)
void INotifyAddedToWorld.AddedToWorld(Actor self)
{
trail = new ContrailRenderable(self.World, color, info.TrailWidth, info.TrailLength, 0, info.ZOffset);
}