public Cell FindCellByPositon(Vector2 Offset, Cell Cell)
{
return AllCell.Find(cell => cell.Position == Cell.Position + Offset && cell.UnitInCell == null);
}
public List<Cell> CalculateVariants(List<Vector2> movevariants, List<Vector2> attackvariants)
{
var variants = new List<Cell>();
var cell = new Cell();
foreach (Vector2 offset in movevariants)
{
cell = GridRepository.Cells.Find(cell => cell.Position == cell.Position + offset && cell.Unit == null);
if (cell != null)
{
variants.Add(cell);
}
}
foreach (Vector2 offset in attackvariants)
{
cell = GridRepository.Cells.Find(cell => cell.Position == cell.Position + offset && cell.Unit != null);
if (cell != null)
{
variants.Add(cell);
}
}
return variants;
}