money works

This commit is contained in:
Chris Forbes
2009-11-05 21:32:34 +13:00
parent d385a89283
commit 841292fdf0
4 changed files with 25 additions and 9 deletions

View File

@@ -7,11 +7,10 @@ namespace OpenRa.Game.Traits
{
class Harvester : IOrder
{
const int capacity = 28;
public int oreCarried = 0; /* sum of these must not exceed capacity */
public int gemsCarried = 0;
public bool IsFull { get { return oreCarried + gemsCarried == capacity; } }
public bool IsFull { get { return oreCarried + gemsCarried == Rules.General.BailCount; } }
public bool IsEmpty { get { return oreCarried == 0 && gemsCarried == 0; } }
public void AcceptResource(bool isGem)
@@ -20,6 +19,14 @@ namespace OpenRa.Game.Traits
else oreCarried++;
}
public void Deliver(Actor self)
{
self.Owner.GiveCash(oreCarried * Rules.General.GoldValue);
self.Owner.GiveCash(gemsCarried * Rules.General.GemValue);
oreCarried = 0;
gemsCarried = 0;
}
public Order Order(Actor self, int2 xy, bool lmb, Actor underCursor)
{
if (lmb) return null;