New interface for things that show on radar; groundwork for future patches.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.GameRules;
|
||||
@@ -47,7 +48,7 @@ namespace OpenRA.Traits
|
||||
public object Create(ActorInitializer init) { return new Building(init); }
|
||||
}
|
||||
|
||||
public class Building : INotifyDamage, IResolveOrder, ITick, IRenderModifier, IOccupySpace
|
||||
public class Building : INotifyDamage, IResolveOrder, ITick, IRenderModifier, IOccupySpace, IRadarSignature
|
||||
{
|
||||
readonly Actor self;
|
||||
public readonly BuildingInfo Info;
|
||||
@@ -160,5 +161,15 @@ 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)
|
||||
{
|
||||
return self.Owner.Color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,12 @@ namespace OpenRA.Traits
|
||||
public interface IExplodeModifier { bool ShouldExplode(Actor self); }
|
||||
public interface INudge { void OnNudge(Actor self, Actor nudger); }
|
||||
|
||||
public interface IRadarSignature
|
||||
{
|
||||
IEnumerable<int2> RadarSignatureCells(Actor self);
|
||||
Color RadarSignatureColor(Actor self);
|
||||
}
|
||||
|
||||
public interface IOccupySpace
|
||||
{
|
||||
int2 TopLeft { get; }
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
public class UnitInfo : OwnedActorInfo, ITraitInfo
|
||||
@@ -19,7 +22,7 @@ namespace OpenRA.Traits
|
||||
public object Create( ActorInitializer init ) { return new Unit(); }
|
||||
}
|
||||
|
||||
public class Unit : INotifyDamage
|
||||
public class Unit : INotifyDamage, IRadarSignature
|
||||
{
|
||||
[Sync]
|
||||
public int Facing;
|
||||
@@ -32,5 +35,15 @@ namespace OpenRA.Traits
|
||||
if (self.Owner == self.World.LocalPlayer)
|
||||
Sound.PlayVoice("Lost", self);
|
||||
}
|
||||
|
||||
public IEnumerable<int2> RadarSignatureCells(Actor self)
|
||||
{
|
||||
yield return self.Location;
|
||||
}
|
||||
|
||||
public Color RadarSignatureColor(Actor self)
|
||||
{
|
||||
return self.Owner.Color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user