Demotruck logic

This commit is contained in:
Paul Chote
2010-01-03 23:54:46 +13:00
parent 44b6469ee6
commit 38ac11e9c7
5 changed files with 5 additions and 4 deletions

View File

@@ -200,6 +200,7 @@
<Compile Include="Traits\Chronoshiftable.cs" /> <Compile Include="Traits\Chronoshiftable.cs" />
<Compile Include="Traits\ChronoshiftPaletteEffect.cs" /> <Compile Include="Traits\ChronoshiftPaletteEffect.cs" />
<Compile Include="Traits\Chronosphere.cs" /> <Compile Include="Traits\Chronosphere.cs" />
<Compile Include="Traits\DemoTruck.cs" />
<Compile Include="Traits\EngineerCapture.cs" /> <Compile Include="Traits\EngineerCapture.cs" />
<Compile Include="Traits\Explodes.cs" /> <Compile Include="Traits\Explodes.cs" />
<Compile Include="Traits\ChronoshiftDeploy.cs" /> <Compile Include="Traits\ChronoshiftDeploy.cs" />

View File

@@ -24,7 +24,7 @@ namespace OpenRa.Game.Orders
var loc = mi.Location + Game.viewport.Location; var loc = mi.Location + Game.viewport.Location;
var underCursor = Game.FindUnits(loc, loc) var underCursor = Game.FindUnits(loc, loc)
.Where(a => a.Owner == Game.LocalPlayer .Where(a => a.Owner == Game.LocalPlayer
&& a.traits.Contains<Unit>() && a.traits.WithInterface<IChronoshiftable>().Any()
&& a.Info.Selectable).FirstOrDefault(); && a.Info.Selectable).FirstOrDefault();
var unit = underCursor != null ? underCursor.Info as UnitInfo : null; var unit = underCursor != null ? underCursor.Info as UnitInfo : null;

View File

@@ -6,7 +6,7 @@ using System.Drawing;
namespace OpenRa.Game.Traits namespace OpenRa.Game.Traits
{ {
class Chronoshiftable : IOrder, ISpeedModifier, ITick class Chronoshiftable : IOrder, ISpeedModifier, ITick, IChronoshiftable
{ {
// Return-to-sender logic // Return-to-sender logic
int2 chronoshiftOrigin; int2 chronoshiftOrigin;

View File

@@ -43,7 +43,7 @@ namespace OpenRa.Game.Traits
bool IsCrushableBy(UnitMovementType umt, Player player); bool IsCrushableBy(UnitMovementType umt, Player player);
bool IsPathableCrush(UnitMovementType umt, Player player); bool IsPathableCrush(UnitMovementType umt, Player player);
} }
interface IChronoshiftable{}
struct Renderable struct Renderable
{ {
public readonly Sprite Sprite; public readonly Sprite Sprite;

View File

@@ -23,7 +23,7 @@ Voice=VehicleVoice
[DTRK] [DTRK]
Description=Demo Truck Description=Demo Truck
Traits=Unit, Mobile, AttackBase, RenderUnit, Chronoshiftable Traits=Unit, Mobile, AttackBase, RenderUnit, DemoTruck
Voice=VehicleVoice Voice=VehicleVoice
[QTNK] [QTNK]