Add a WarnCrush method to ICrushable which is called when a crusher begins to enter the cell.

This commit is contained in:
Paul Chote
2011-06-26 15:31:07 +12:00
parent 74d13286a8
commit 19ead53223
6 changed files with 20 additions and 1 deletions

View File

@@ -329,6 +329,17 @@ namespace OpenRA.Mods.RA.Move
return Info.CanEnterCell(self.World, self.Owner, cell, ignoreActor, checkTransientActors);
}
public void EnteringCell(Actor self)
{
var crushable = self.World.ActorMap.GetUnitsAt(toCell).Where(a => a != self && a.HasTrait<ICrushable>());
foreach (var a in crushable)
{
var crushActions = a.TraitsImplementing<ICrushable>().Where(b => b.CrushableBy(Info.Crushes, self.Owner));
foreach (var b in crushActions)
b.WarnCrush(self);
}
}
public void FinishedMoving(Actor self)
{
var crushable = self.World.ActorMap.GetUnitsAt(toCell).Where(a => a != self && a.HasTrait<ICrushable>());