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:
34
OpenRa.Game/Traits/Activities/UnloadCargo.cs
Normal file
34
OpenRa.Game/Traits/Activities/UnloadCargo.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user