本文整理汇总了C#中Room.possibleExits方法的典型用法代码示例。如果您正苦于以下问题:C# Room.possibleExits方法的具体用法?C# Room.possibleExits怎么用?C# Room.possibleExits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room.possibleExits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: expandRoom
protected uint expandRoom(Room room, Vector2 roomPos, Room[,] roomGrid)
{
List<uint> validExits = new List<uint>();
foreach (uint maybeExit in room.possibleExits()) {
if (maybeExit == GridPiece.UP && roomPos.y < MAX_MAP_SIZE-1 && roomGrid[(int)roomPos.x, (int)roomPos.y+1] == null)
validExits.Add(maybeExit);
if (maybeExit == GridPiece.RIGHT && roomPos.x < MAX_MAP_SIZE-1 && roomGrid[(int)roomPos.x+1, (int)roomPos.y] == null)
validExits.Add(maybeExit);
if (maybeExit == GridPiece.DOWN && roomPos.y > 0 && roomGrid[(int)roomPos.x, (int)roomPos.y-1] == null)
validExits.Add(maybeExit);
if (maybeExit == GridPiece.LEFT && roomPos.x > 0 && roomGrid[(int)roomPos.x-1, (int)roomPos.y] == null)
validExits.Add(maybeExit);
}
if (validExits.Count == 0)
throw new UnityException("Room Expansion Failure!");
return Globals.getRandom(validExits);
}