From 024887b268d6bc3ba1020917330274be5f3c18a5 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Mon, 4 Sep 2017 19:38:29 +0200 Subject: [PATCH] Move Contrail to Traits And make interface implementations explicit while we're at it. --- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 2 +- OpenRA.Mods.Common/{Effects => Traits}/Contrail.cs | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) rename OpenRA.Mods.Common/{Effects => Traits}/Contrail.cs (91%) diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 167eb26aa1..9371ee7322 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -134,7 +134,6 @@ - @@ -295,6 +294,7 @@ + diff --git a/OpenRA.Mods.Common/Effects/Contrail.cs b/OpenRA.Mods.Common/Traits/Contrail.cs similarity index 91% rename from OpenRA.Mods.Common/Effects/Contrail.cs rename to OpenRA.Mods.Common/Traits/Contrail.cs index a9750cba18..1dd82dd956 100644 --- a/OpenRA.Mods.Common/Effects/Contrail.cs +++ b/OpenRA.Mods.Common/Traits/Contrail.cs @@ -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 @@ -61,18 +60,18 @@ namespace OpenRA.Mods.Common.Effects body = self.Trait(); } - 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 Render(Actor self, WorldRenderer wr) + IEnumerable 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); }