stripped dead code from move; added rally point support
This commit is contained in:
@@ -116,31 +116,12 @@ namespace OpenRa.Game.Traits.Activities
|
||||
|
||||
Game.UnitInfluence.Remove( mobile );
|
||||
var newPath = getPath(self, mobile).TakeWhile(a => a != self.Location).ToList();
|
||||
//var newPath = Game.PathFinder.FindPathToPath( self.Location, path, mobile.GetMovementType() )
|
||||
// .TakeWhile( a => a != self.Location )
|
||||
// .ToList();
|
||||
|
||||
Game.UnitInfluence.Add( mobile );
|
||||
if (newPath.Count == 0)
|
||||
return null;
|
||||
else
|
||||
{
|
||||
if (newPath.Count != 0)
|
||||
path = newPath;
|
||||
return null;
|
||||
}
|
||||
|
||||
//while( path.Count != 0 && path[ path.Count - 1 ] != newPath[ 0 ] )
|
||||
// path.RemoveAt( path.Count - 1 );
|
||||
//for( int i = 1 ; i < newPath.Count ; i++ )
|
||||
// path.Add( newPath[ i ] );
|
||||
|
||||
if( path.Count == 0 )
|
||||
return null;
|
||||
nextCell = path[ path.Count - 1 ];
|
||||
if( !CanEnterCell( nextCell, self ) )
|
||||
{
|
||||
path.Clear();
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
path.RemoveAt( path.Count - 1 );
|
||||
return nextCell;
|
||||
|
||||
38
OpenRa.Game/Traits/RallyPoint.cs
Normal file
38
OpenRa.Game/Traits/RallyPoint.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using IjwFramework.Types;
|
||||
using OpenRa.Game.Graphics;
|
||||
|
||||
namespace OpenRa.Game.Traits
|
||||
{
|
||||
class RallyPoint : IRender, IOrder, ITick
|
||||
{
|
||||
public int2 rallyPoint;
|
||||
public Animation anim;
|
||||
|
||||
public RallyPoint(Actor self)
|
||||
{
|
||||
rallyPoint = self.Location + new int2(1, 3); //self.unitInfo.RallyPoint;
|
||||
anim = new Animation("flagfly");
|
||||
anim.PlayRepeating("idle");
|
||||
}
|
||||
|
||||
public IEnumerable<Pair<Sprite, float2>> Render(Actor self)
|
||||
{
|
||||
var uog = Game.controller.orderGenerator as UnitOrderGenerator;
|
||||
if (uog != null && self.Owner == Game.LocalPlayer && uog.selection.Contains(self))
|
||||
yield return Util.Centered(
|
||||
anim.Image, Game.CellSize * (new float2(.5f, .5f) + rallyPoint.ToFloat2()));
|
||||
}
|
||||
|
||||
public Order Order(Actor self, int2 xy, bool lmb, Actor underCursor)
|
||||
{
|
||||
if (lmb || underCursor != null) return null;
|
||||
return OpenRa.Game.Order.SetRallyPoint(self, xy);
|
||||
}
|
||||
|
||||
public void Tick(Actor self) { anim.Tick(); }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user