Refactor Traits.fake into a Tags interface for primary production structures +mods

This commit is contained in:
Paul
2009-12-19 19:08:15 -08:00
parent 301873f88e
commit 975624d2f9
5 changed files with 54 additions and 26 deletions

View File

@@ -1,14 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenRa.Game.Traits
{
class Fake
class Fake : ITags
{
public Fake(Actor self){}
public Fake(Actor self){}
public IEnumerable<TagType> GetTags()
{
yield return TagType.Fake;
}
}
}

View File

@@ -1,9 +1,10 @@
using OpenRa.Game.GameRules;
using System.Linq;
using System.Collections.Generic;
namespace OpenRa.Game.Traits
{
class Production : IProducer
class Production : IProducer, ITags
{
public Production( Actor self ) { }
@@ -50,6 +51,11 @@ namespace OpenRa.Game.Traits
return true;
}
public IEnumerable<TagType> GetTags()
{
yield return (true) ? TagType.Primary : TagType.None;
}
}
class ProductionSurround : Production

View File

@@ -6,7 +6,10 @@ using System.Drawing;
namespace OpenRa.Game.Traits
{
enum DamageState { Normal, Half, Dead };
// depends on the order of pips in WorldRenderer.cs!
enum PipType { Transparent, Green, Yellow, Red, Gray };
enum TagType { None, Fake, Primary };
interface ITick { void Tick(Actor self); }
interface IRender { IEnumerable<Tuple<Sprite, float2, int>> Render(Actor self); }
@@ -25,4 +28,5 @@ namespace OpenRa.Game.Traits
interface IDamageModifier { float GetDamageModifier(); }
interface ISpeedModifier { float GetSpeedModifier(); }
interface IPips { IEnumerable<PipType> GetPips(); }
interface ITags { IEnumerable<TagType> GetTags(); }
}