本文整理汇总了C#中Direction.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Direction.Select方法的具体用法?C# Direction.Select怎么用?C# Direction.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Direction
的用法示例。
在下文中一共展示了Direction.Select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsGoblinAdjacent
bool IsGoblinAdjacent(Vector2 location, out Vector2 goblinLocation)
{
var goblins = EntityManager.GetGoblins ();
var checkableDirections = new Direction[] {
Direction.Down,
Direction.Up,
Direction.Right,
Direction.Left
};
foreach (var direction in checkableDirections.Select(d => d.ToVector2())) {
var goblin = goblins.FirstOrDefault (g => g.GetTile ().Position == location + direction);
if (goblin != null) {
goblinLocation = goblin.GetTile().Position;
return true;
}
}
goblinLocation = Vector2.zero;
return false;
}
示例2: IsFireAdjacent
bool IsFireAdjacent(Vector2 location, out Vector2 fire)
{
var fires = FireManager.GetBurningTiles ();
var checkableDirections = new Direction[] {
Direction.Up,
Direction.Down,
Direction.Left,
Direction.Right
};
foreach (var direction in checkableDirections.Select(d => d.ToVector2())) {
var burningTile = fires.FirstOrDefault (f => f.Position == location + direction);
if (burningTile != null) {
fire = burningTile.Position;
return true;
}
}
fire = Vector2.zero;
return false;
}
示例3: MultipleAxisMove
/// <summary>
/// 多軸移動
/// </summary>
/// <param name="axiss">移動若干軸,依陣列表示</param>
/// <param name="dirs">表明若干軸,各自移動的方向(正向移動或負向移動),依陣列表示</param>
/// <param name="velocity">移動若干軸之速度</param>
public void MultipleAxisMove(Axis[] axiss, Direction[] dirs, int velocity)
{
try
{
int[] axisList = new int[axiss.Length + 1];
for (int i = 0; i < axiss.Length; i++)
{
axisList[i] = (int)axiss[i];
}
axisList[axiss.Length] = -1;
var dirList = dirs.Select(s => (int)s).ToArray();
_ch.JogM(_ch.ACSC_AMF_VELOCITY, axisList, dirList, velocity);
}
catch (COMException ex)
{
On_ErrorHandler(null, ex);
_log.Error("MultipleAxisMove, Error={0}", ex.StackTrace);
}
}