Added IDisabledTrait & rewrote upgrade code using a level-based approach.

Upgradeable traits are notified whenever an upgrade of their declared types are granted or revoked.  The traits maintain their own internal level counter, which is then used to enable or disable the trait functionality.  A trait can register for multiple upgrade types which then all affect the internal level counter.

	IDisabledTrait for identifying (and filtering) disabled traits
	UpgradableTrait provides an abstract base for traits to support upgrade levels
	Added IDisabledTrait support to GlobalButtonOrderGenerator

	Includes rework by pchote with alterations.
This commit is contained in:
atlimit8
2014-10-13 18:09:16 -05:00
parent 76cf5b8b98
commit bbd54cb32f
38 changed files with 545 additions and 415 deletions

View File

@@ -104,12 +104,6 @@ namespace OpenRA.Traits
public interface INotifyInfiltrated { void Infiltrated(Actor self, Actor infiltrator); }
public interface IDisableMove { bool MoveDisabled(Actor self); }
public interface IUpgradable
{
bool AcceptsUpgrade(string type);
void UpgradeAvailable(Actor self, string type, bool available);
}
public interface ISeedableResource { void Seed(Actor self); }
public interface IDemolishableInfo { bool IsValidTarget(ActorInfo actorInfo, Actor saboteur); }
@@ -140,6 +134,7 @@ namespace OpenRA.Traits
bool IsOwnerRowVisible { get; }
}
public interface IDisabledTrait { bool IsTraitDisabled { get; } }
public interface IDisable { bool Disabled { get; } }
public interface IExplodeModifier { bool ShouldExplode(Actor self); }
public interface IHuskModifier { string HuskActor(Actor self); }