git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1313 993157c7-ee19-0410-b2c4-bb4e9862e678

This commit is contained in:
(no author)
2007-07-20 07:14:30 +00:00
parent db17062511
commit 434ec200c9
6 changed files with 95 additions and 28 deletions

View File

@@ -6,6 +6,8 @@ namespace OpenRa.Game
{
abstract class Unit : Actor, ISelectable
{
protected Animation animation;
protected int facing = 0;
protected int2 fromCell, toCell;
protected int moveFraction, moveFractionTotal;
@@ -16,11 +18,14 @@ namespace OpenRa.Game
protected readonly float2 renderOffset;
public Unit( int2 cell, int palette, float2 renderOffset )
public Unit( string name, int2 cell, int palette, float2 renderOffset )
{
fromCell = toCell = cell;
this.renderOffset = renderOffset;
this.palette = palette;
animation = new Animation( name );
animation.PlayFetchIndex( "idle", delegate { return facing; } );
}
static float2[] fvecs = Util.MakeArray<float2>( 32,
@@ -51,6 +56,7 @@ namespace OpenRa.Game
public override void Tick( World world, double t )
{
animation.Tick( t );
if( currentOrder == null && nextOrder != null )
{
currentOrder = nextOrder;
@@ -128,5 +134,10 @@ namespace OpenRa.Game
return ( location - renderOffset ).Round(); ;
}
}
public override Sprite[] CurrentImages
{
get { return animation.Images; }
}
}
}