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

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -176,7 +176,6 @@
<Compile Include="Traits\Render\RenderSimple.cs" />
<Compile Include="Traits\TraitsInterfaces.cs" />
<Compile Include="Traits\Turreted.cs" />
<Compile Include="Traits\Unit.cs" />
<Compile Include="Traits\World\UnitInfluence.cs" />
<Compile Include="Network\UnitOrders.cs" />
<Compile Include="Traits\Util.cs" />
@@ -258,4 +257,7 @@
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<Folder Include="Traits\" />
</ItemGroup>
</Project>

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Traits
public object Create(ActorInitializer init) { return new Building(init); }
}
public class Building : INotifyDamage, IResolveOrder, IRenderModifier, IOccupySpace, IRadarSignature
public class Building : INotifyDamage, IResolveOrder, IRenderModifier, IOccupySpace
{
readonly Actor self;
public readonly BuildingInfo Info;
@@ -113,19 +113,5 @@ namespace OpenRA.Traits
{
return Footprint.UnpathableTiles( self.Info.Name, Info, TopLeft );
}
public IEnumerable<int2> RadarSignatureCells(Actor self)
{
return Footprint.Tiles(self);
}
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

@@ -17,7 +17,7 @@ using OpenRA.Traits.Activities;
namespace OpenRA.Traits
{
public class MobileInfo : ITraitInfo, ITraitPrerequisite<UnitInfo>
public class MobileInfo : ITraitInfo
{
public readonly string[] TerrainTypes;
public readonly float[] TerrainSpeeds;

View File

@@ -1,38 +0,0 @@
#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;
namespace OpenRA.Traits
{
public class UnitInfo : ITraitInfo
{
public object Create( ActorInitializer init ) { return new Unit(); }
}
public class Unit : IRadarSignature
{
public IEnumerable<int2> RadarSignatureCells(Actor self)
{
yield return self.Location;
}
public Color RadarSignatureColor(Actor self)
{
var mod = self.traits.WithInterface<IRadarColorModifier>().FirstOrDefault();
if (mod != null)
return mod.RadarColorOverride(self);
return self.Owner.Color;
}
}
}