Make WithRotor independent from WithTurret

Move WithRotor to Mods.Common
This commit is contained in:
reaperrr
2014-12-18 13:23:58 +01:00
parent 5b011e6baf
commit de224a381d
3 changed files with 9 additions and 4 deletions

View File

@@ -162,6 +162,7 @@
<Compile Include="Traits\Render\WithBuildingPlacedAnimation.cs" />
<Compile Include="Traits\Render\WithDeathAnimation.cs" />
<Compile Include="Traits\Render\WithResources.cs" />
<Compile Include="Traits\Render\WithRotor.cs" />
<Compile Include="Traits\Render\WithShadow.cs" />
<Compile Include="Traits\Render\WithSmoke.cs" />
<Compile Include="Traits\ShakeOnDeath.cs" />

View File

@@ -12,10 +12,9 @@ using System;
using System.Collections.Generic;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Render
namespace OpenRA.Mods.Common.Traits
{
[Desc("Displays a helicopter rotor overlay.")]
public class WithRotorInfo : ITraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo>
@@ -64,7 +63,7 @@ namespace OpenRA.Mods.RA.Render
rotorAnim.PlayRepeating(info.Sequence);
rs.Add(info.Id, new AnimationWithOffset(rotorAnim,
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
null, () => false, p => WithTurret.ZOffsetFromCenter(self, p, 1)));
null, () => false, p => ZOffsetFromCenter(self, p, 1)));
}
public void Tick(Actor self)
@@ -75,5 +74,11 @@ namespace OpenRA.Mods.RA.Render
rotorAnim.ReplaceAnim(isFlying ? info.Sequence : info.GroundSequence);
}
static public int ZOffsetFromCenter(Actor self, WPos pos, int offset)
{
var delta = self.CenterPosition - pos;
return delta.Y + delta.Z + offset;
}
}
}

View File

@@ -239,7 +239,6 @@
<Compile Include="Render\RenderLandingCraft.cs" />
<Compile Include="Render\WithBuildingExplosion.cs" />
<Compile Include="Render\WithMuzzleFlash.cs" />
<Compile Include="Render\WithRotor.cs" />
<Compile Include="Repairable.cs" />
<Compile Include="RepairableNear.cs" />
<Compile Include="ScaredyCat.cs" />