presence of the trait is enough; don't need to check a legacy flag too.

This commit is contained in:
Chris Forbes
2009-12-28 13:31:08 +13:00
parent 650a0c333a
commit c5c1ec79ab
4 changed files with 12 additions and 15 deletions

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRa.Game.GameRules;
namespace OpenRa.Game.Traits
{
class SquishByTank : ICrushable
{
readonly Actor self;
public SquishByTank(Actor self)
{
this.self = self;
}
public void OnCrush(Actor crusher)
{
self.InflictDamage(crusher, self.Health, Rules.WarheadInfo["Crush"]);
}
public bool IsPathableCrush(UnitMovementType umt, Player player)
{
return IsCrushableBy(umt, player);
}
public bool IsCrushableBy(UnitMovementType umt, Player player)
{
if (player == Game.LocalPlayer) return false;
switch (umt)
{
case UnitMovementType.Track: return true;
default: return false;
}
}
}
}