Trait-based units. Any unit/building without sequences will cause a crash when built.

This commit is contained in:
Bob
2009-10-10 00:31:16 +13:00
parent a08bcd9a17
commit 3181b055aa
18 changed files with 1377 additions and 1182 deletions

View File

@@ -1,58 +1,60 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenRa.Game
{
abstract class Order
{
public abstract void Apply( Game game );
}
class MoveOrder : Order
{
public readonly Unit Unit;
public readonly int2 Destination;
public MoveOrder(Unit unit, int2 destination)
{
this.Unit = unit;
this.Destination = destination;
}
public override void Apply( Game game )
{
Unit.nextOrder = UnitMissions.Move( Unit, Destination );
}
}
class DeployMcvOrder : Order
{
Unit unit;
public DeployMcvOrder( Unit unit )
{
this.unit = unit;
}
public override void Apply( Game game )
{
unit.nextOrder = UnitMissions.Deploy( unit );
}
}
class HarvestOrder : Order
{
Unit unit;
public HarvestOrder( Unit unit )
{
this.unit = unit;
}
public override void Apply( Game game )
{
unit.nextOrder = UnitMissions.Harvest( unit );
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenRa.Game
{
abstract class Order
{
public abstract void Apply( Game game );
}
class MoveOrder : Order
{
public readonly Actor Unit;
public readonly int2 Destination;
public MoveOrder( Actor unit, int2 destination )
{
this.Unit = unit;
this.Destination = destination;
}
public override void Apply( Game game )
{
Unit.traits.Get<Traits.Mobile>().destination = Destination;
}
}
class DeployMcvOrder : Order
{
Actor Unit;
public DeployMcvOrder( Actor unit )
{
Unit = unit;
}
public override void Apply( Game game )
{
Unit.traits.Get<Traits.McvDeploy>().Deploying = true;
var mobile = Unit.traits.Get<Traits.Mobile>();
mobile.destination = mobile.toCell;
}
}
//class HarvestOrder : Order
//{
// Unit unit;
// public HarvestOrder( Unit unit )
// {
// this.unit = unit;
// }
// public override void Apply( Game game )
// {
// unit.nextOrder = UnitMissions.Harvest( unit );
// }
//}
}