本文整理汇总了C#中Directions.Where方法的典型用法代码示例。如果您正苦于以下问题:C# Directions.Where方法的具体用法?C# Directions.Where怎么用?C# Directions.Where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Directions
的用法示例。
在下文中一共展示了Directions.Where方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsSimilarByColores
private bool IsSimilarByColores(Directions[] interestingSide, Dictionary<Directions, Colores> originSides)
{
return interestingSide.
Where(side => !Side2Colores[side].Equals(Colores.Uncolored)).
Any(side => Side2Colores[side].Equals(originSides[side]));
}
示例2: DetermineNextLocation
private static Int3 DetermineNextLocation(Room room, Int3 currentLocation, Directions[] possibleDirections, ref Directions lastDirection)
{
Directions invalidDirections = Directions.None;
var foundValidDirection = false;
var intendedLocation = currentLocation;
var currentSide = room.roomBuffer[currentLocation.X, currentLocation.Y, currentLocation.Z];
if (lastDirection == Directions.Left)
{
invalidDirections |= Directions.Right;
}
if (lastDirection == Directions.Right)
{
invalidDirections |= Directions.Left;
}
if (lastDirection == Directions.Up)
{
invalidDirections |= Directions.Down;
}
if (lastDirection == Directions.Down)
{
invalidDirections |= Directions.Up;
}
if (lastDirection == Directions.Forward)
{
invalidDirections |= Directions.Back;
}
if (lastDirection == Directions.Back)
{
invalidDirections |= Directions.Forward;
}
if ((currentSide & Sides.Left) > 0)
{
invalidDirections |= Directions.Left;
invalidDirections |= Directions.Right;
}
if ((currentSide & Sides.Right) > 0)
{
invalidDirections |= Directions.Left;
invalidDirections |= Directions.Right;
}
if ((currentSide & Sides.Top) > 0)
{
invalidDirections |= Directions.Up;
invalidDirections |= Directions.Down;
}
if ((currentSide & Sides.Bottom) > 0)
{
invalidDirections |= Directions.Up;
invalidDirections |= Directions.Down;
}
if ((currentSide & Sides.Front) > 0)
{
invalidDirections |= Directions.Back;
invalidDirections |= Directions.Forward;
}
if ((currentSide & Sides.Rear) > 0)
{
invalidDirections |= Directions.Back;
invalidDirections |= Directions.Forward;
}
while (!foundValidDirection)
{
intendedLocation = currentLocation;
if (invalidDirections >= Directions.NUM_VALUES - 1)
{
throw new InvalidSolveException();
}
var directions = invalidDirections;
lastDirection = possibleDirections.Where(d => (directions & d) == 0).SelectRandom();
if (lastDirection == Directions.None)
throw new InvalidSolveException();
switch (lastDirection)
{
case Directions.Forward:
intendedLocation.Z += 1;
if (intendedLocation.Z == room.Depth)
{
invalidDirections |= lastDirection;
}
else
{
if (room.roomBuffer[intendedLocation.X, intendedLocation.Y, intendedLocation.Z] !=
Sides.None)
{
invalidDirections |= lastDirection;
}
else
{
foundValidDirection = true;
//.........这里部分代码省略.........
示例3: IsEqualByColores
public bool IsEqualByColores(Directions[] interestingSides, Dictionary<Directions, Colores> originSides)
{
return interestingSides.
Where(side => (!Side2Colores[side].Equals(Colores.Uncolored))).
All(side => Side2Colores[side].Equals(originSides[side]));
}