New extendable mechanism for disabling units

This commit is contained in:
Paul Chote
2010-01-25 20:18:12 +13:00
parent 3aa40c36cf
commit f0ae162fb0
11 changed files with 254 additions and 211 deletions

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRa.Traits;
namespace OpenRa.Mods.RA
{
class RequiresPowerInfo : ITraitInfo
{
public object Create(Actor self) { return new RequiresPower(self); }
}
class RequiresPower : IDisable
{
readonly Actor self;
public RequiresPower( Actor self )
{
this.self = self;
}
public bool Disabled
{
get { return (self.Owner.GetPowerState() != PowerState.Normal); }
set {} // Cannot explicity set
}
}
}