Merge branch 'master' of git://github.com/beedee/OpenRA

This commit is contained in:
Chris Forbes
2009-11-09 22:29:43 +13:00
8 changed files with 77 additions and 69 deletions

View File

@@ -2,10 +2,11 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenRa.Game.GameRules;
namespace OpenRa.Game.Traits
{
class Building : ITick
class Building : ITick, INotifyBuildComplete
{
public Building(Actor self)
{
@@ -19,5 +20,13 @@ namespace OpenRa.Game.Traits
first = false;
}
public void BuildingComplete(Actor self)
{
UnitInfo.BuildingInfo bi = self.unitInfo as UnitInfo.BuildingInfo;
if (bi == null) return;
self.Owner.Power += bi.Power;
}
}
}

View File

@@ -18,7 +18,12 @@ namespace OpenRa.Game.Traits
public RenderBuilding(Actor self)
: base(self)
{
Make( () => anim.PlayRepeating("idle") );
Make(() =>
{
anim.PlayRepeating("idle");
foreach (var x in self.traits.WithInterface<INotifyBuildComplete>())
x.BuildingComplete(self);
});
DoBib(self, false);
}

View File

@@ -14,4 +14,5 @@ namespace OpenRa.Game.Traits
interface IOrder { Order Order(Actor self, int2 xy, bool lmb, Actor underCursor); }
interface INotifyDamage { void Damaged(Actor self, DamageState ds); }
interface INotifyDamageEx : INotifyDamage { void Damaged(Actor self, int damage); }
interface INotifyBuildComplete { void BuildingComplete (Actor self); }
}