Kill Unit trait; Radar signature tweaks

This commit is contained in:
Paul Chote
2010-08-01 01:26:59 +12:00
parent d416f0be5c
commit bd979f65b8
13 changed files with 41 additions and 113 deletions

View File

@@ -0,0 +1,39 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
public class AppearsOnRadarInfo : TraitInfo<AppearsOnRadar> {}
public class AppearsOnRadar : IRadarSignature
{
IOccupySpace Space;
public IEnumerable<int2> RadarSignatureCells(Actor self)
{
if (Space == null)
Space = self.traits.Get<IOccupySpace>();
return Space.OccupiedCells();
}
public Color RadarSignatureColor(Actor self)
{
var mod = self.traits.WithInterface<IRadarColorModifier>().FirstOrDefault();
if (mod != null)
return mod.RadarColorOverride(self);
return self.Owner.Color;
}
}
}

View File

@@ -233,6 +233,7 @@
<Compile Include="Transforms.cs" />
<Compile Include="Activities\Transform.cs" />
<Compile Include="ActorLostNotification.cs" />
<Compile Include="AppearsOnRadar.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
@@ -244,9 +245,6 @@
<Name>OpenRA.Game</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Chrome\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.