cargo: added cargo-related sequences for APC/LST/TRAN; moved Passengers onto UnitInfo for convenience (and to allow garrisoning without a big hack); added Cargo trait to all known transports

This commit is contained in:
Chris Forbes
2010-01-05 12:50:12 +13:00
parent e74bcba694
commit 323d4bd671
6 changed files with 112 additions and 8 deletions

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenRa.Game.Traits.Activities
{
class UnloadCargo : IActivity
{
public IActivity NextActivity { get; set; }
bool isCanceled;
public IActivity Tick(Actor self)
{
if (isCanceled) return NextActivity;
// if we're a thing that can turn, turn to the
// right facing for the unload animation
var unit = self.traits.GetOrDefault<Unit>();
if (unit != null && unit.Facing != self.Info.UnloadFacing)
return Util.SequenceActivities(new Turn(self.Info.UnloadFacing), this);
// todo: play the `open` anim (or the `close` anim backwards)
// todo: unload all the cargo
// todo: play the `close` anim (or the `open` anim backwards)
// as for open/close... the westwood guys suck at being consistent.
return this;
}
public void Cancel(Actor self) { NextActivity = null; isCanceled = true; }
}
}