Merge branch 'master' of git://github.com/beedee/OpenRA
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user