cargo: unloading works

This commit is contained in:
Chris Forbes
2010-01-05 13:40:06 +13:00
parent 323d4bd671
commit 0b1ea48c09
5 changed files with 64 additions and 8 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenRa.Game.GameRules;
using OpenRa.Game.Traits.Activities;
namespace OpenRa.Game.Traits
{
@@ -10,7 +11,15 @@ namespace OpenRa.Game.Traits
{
List<Actor> cargo = new List<Actor>();
public Cargo(Actor self) { }
public Cargo(Actor self)
{
// hack:
cargo.Add(new Actor(Rules.UnitInfo["E1"], int2.Zero, self.Owner));
cargo.Add(new Actor(Rules.UnitInfo["E1"], int2.Zero, self.Owner));
cargo.Add(new Actor(Rules.UnitInfo["E1"], int2.Zero, self.Owner));
cargo.Add(new Actor(Rules.UnitInfo["E6"], int2.Zero, self.Owner));
cargo.Add(new Actor(Rules.UnitInfo["E7"], int2.Zero, self.Owner));
}
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
{
@@ -27,6 +36,7 @@ namespace OpenRa.Game.Traits
{
// todo: eject the units
self.CancelActivity();
self.QueueActivity(new UnloadCargo());
}
}
@@ -35,6 +45,18 @@ namespace OpenRa.Game.Traits
return cargo.Count == self.Info.Passengers;
}
public bool IsEmpty(Actor self)
{
return cargo.Count == 0;
}
public Actor UnloadOne(Actor self)
{
var a = cargo[0];
cargo.RemoveAt(0);
return a;
}
public IEnumerable<PipType> GetPips( Actor self )
{
for (var i = 0; i < self.Info.Passengers; i++)