本文整理汇总了C#中Cell.Move方法的典型用法代码示例。如果您正苦于以下问题:C# Cell.Move方法的具体用法?C# Cell.Move怎么用?C# Cell.Move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cell
的用法示例。
在下文中一共展示了Cell.Move方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CountFreeInputs
private int CountFreeInputs(Cell cell, Unit unit = null)
{
int nfree = 0;
foreach (var move in up)
{
var c = cell.Move(move);
if (c.x < 0 || c.y < 0 || c.x >= map.Width || c.y >= map.Height) continue;
if (!map[c].filled && (unit == null || !unit.members.Contains(c))) nfree++;
}
return nfree;
}
示例2: FreeInputs
private IEnumerable<Cell> FreeInputs(Cell cell)
{
foreach (var move in up)
{
var c = cell.Move(move);
if (c.x < 0 || c.y < 0 || c.x >= map.Width || c.y >= map.Height) continue;
if (!map[c].filled) yield return c;
}
}
示例3: TestMove
private void TestMove(int fX, int fY, MoveType moveType, int tX, int tY, int length = 1)
{
var cell = new Cell { x = fX, y = fY, filled = false };
var actual = cell.Move(new Vector(moveType, cell.y, length));
Assert.AreEqual(actual.x, tX);
Assert.AreEqual(actual.y, tY);
if (length == 1)
{
var actual2 = cell.Move(moveType);
Assert.AreEqual(actual2.x, tX);
Assert.AreEqual(actual2.y, tY);
}
}
示例4: FindFreeLinearPath
private Cell[] FindFreeLinearPath(Cell cell, MoveType move)
{
var next = cell.Move(move);
List<Cell> path = new List<Cell>();
while (IsCorrect(next) && !map[next].filled && path.Count < maxLenPath)
{
path.Add(next);
next = next.Move(move);
}
return path.ToArray();
}
示例5: CountFreeInputs
private int CountFreeInputs(Cell cell, Unit unit = null)
{
int nfree = 0;
foreach (var move in up)
{
var c = cell.Move(move);
if (!IsCorrect(c) || map[c].filled) continue;
if (unit == null || !unit.members.Contains(c)) nfree++;
}
return nfree;
}