Traits can now resolve orders (ATM, they all resolve the orders they issue)

This commit is contained in:
Bob
2009-11-25 20:42:03 +13:00
parent e9b87640bd
commit 7c1c0835e1
10 changed files with 117 additions and 82 deletions

View File

@@ -18,16 +18,28 @@ namespace OpenRa.Game.Traits
targetLocation = self.Location;
}
public Order Order(Actor self, int2 xy, bool lmb, Actor underCursor)
public Order IssueOrder(Actor self, int2 xy, bool lmb, Actor underCursor)
{
if (lmb) return null;
if (underCursor == null)
return OpenRa.Game.Order.Move(self, xy);
return Order.Move(self, xy);
return null;
}
public void ResolveOrder( Actor self, Order order )
{
if( order.OrderString == "Move" )
{
targetLocation = order.TargetLocation;
var attackBase = self.traits.WithInterface<AttackBase>().FirstOrDefault();
if( attackBase != null )
attackBase.target = null; /* move cancels attack order */
}
}
public void Tick(Actor self)
{
var unit = self.traits.Get<Unit>();