本文整理汇总了C#中IRoom.AddExit方法的典型用法代码示例。如果您正苦于以下问题:C# IRoom.AddExit方法的具体用法?C# IRoom.AddExit怎么用?C# IRoom.AddExit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRoom
的用法示例。
在下文中一共展示了IRoom.AddExit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
public void Configure(IRoom roomObj, string configurationCode)
{
HighLevelRoom room = roomObj as HighLevelRoom;
if (room != null) {
switch (configurationCode)
{
case "O":
break;
case ">":
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.East))
roomObj.AddExit(ExitDirection.EAST, HighLevelRoom.HighLevelLocDict[room.position.East]);
else roomObj.AddExit(ExitDirection.EAST, new HighLevelRoom("<", room.position.East));
break;
case "^":
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.North))
roomObj.AddExit(ExitDirection.NORTH, HighLevelRoom.HighLevelLocDict[room.position.North]);
else roomObj.AddExit(ExitDirection.NORTH, new HighLevelRoom("v", room.position.North));
break;
case "v":
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.South))
roomObj.AddExit(ExitDirection.SOUTH, HighLevelRoom.HighLevelLocDict[room.position.South]);
else roomObj.AddExit(ExitDirection.SOUTH, new HighLevelRoom("^", room.position.South));
break;
case "<":
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.West))
roomObj.AddExit(ExitDirection.WEST, HighLevelRoom.HighLevelLocDict[room.position.West]);
else roomObj.AddExit(ExitDirection.WEST, new HighLevelRoom(">", room.position.West));
break;
case "I":
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.North))
roomObj.AddExit(ExitDirection.NORTH, HighLevelRoom.HighLevelLocDict[room.position.North]);
else roomObj.AddExit(ExitDirection.NORTH, new HighLevelRoom("v", room.position.North));
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.South))
roomObj.AddExit(ExitDirection.SOUTH, HighLevelRoom.HighLevelLocDict[room.position.South]);
else roomObj.AddExit(ExitDirection.SOUTH, new HighLevelRoom("^", room.position.South));
break;
case "-":
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.East))
roomObj.AddExit(ExitDirection.EAST, HighLevelRoom.HighLevelLocDict[room.position.East]);
else roomObj.AddExit(ExitDirection.EAST, new HighLevelRoom("<", room.position.East));
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.West))
roomObj.AddExit(ExitDirection.WEST, HighLevelRoom.HighLevelLocDict[room.position.West]);
else roomObj.AddExit(ExitDirection.WEST, new HighLevelRoom(">", room.position.West));
break;
case "L":
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.North))
roomObj.AddExit(ExitDirection.NORTH, HighLevelRoom.HighLevelLocDict[room.position.North]);
else roomObj.AddExit(ExitDirection.NORTH, new HighLevelRoom("v", room.position.North));
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.East))
roomObj.AddExit(ExitDirection.EAST, HighLevelRoom.HighLevelLocDict[room.position.East]);
else roomObj.AddExit(ExitDirection.EAST, new HighLevelRoom("<", room.position.East));
break;
case "r":
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.East))
roomObj.AddExit(ExitDirection.EAST, HighLevelRoom.HighLevelLocDict[room.position.East]);
else roomObj.AddExit(ExitDirection.EAST, new HighLevelRoom("<", room.position.East));
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.South))
roomObj.AddExit(ExitDirection.SOUTH, HighLevelRoom.HighLevelLocDict[room.position.South]);
else roomObj.AddExit(ExitDirection.SOUTH, new HighLevelRoom("^", room.position.South));
break;
case "7":
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.West))
roomObj.AddExit(ExitDirection.WEST, HighLevelRoom.HighLevelLocDict[room.position.West]);
else roomObj.AddExit(ExitDirection.WEST, new HighLevelRoom(">", room.position.West));
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.South))
roomObj.AddExit(ExitDirection.SOUTH, HighLevelRoom.HighLevelLocDict[room.position.South]);
else roomObj.AddExit(ExitDirection.SOUTH, new HighLevelRoom("^", room.position.South));
break;
case "J":
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.North))
roomObj.AddExit(ExitDirection.NORTH, HighLevelRoom.HighLevelLocDict[room.position.North]);
else roomObj.AddExit(ExitDirection.NORTH, new HighLevelRoom("v", room.position.North));
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.West))
roomObj.AddExit(ExitDirection.WEST, HighLevelRoom.HighLevelLocDict[room.position.West]);
else roomObj.AddExit(ExitDirection.WEST, new HighLevelRoom(">", room.position.West));
break;
case "N":
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.South))
roomObj.AddExit(ExitDirection.SOUTH, HighLevelRoom.HighLevelLocDict[room.position.South]);
else roomObj.AddExit(ExitDirection.SOUTH, new HighLevelRoom("^", room.position.South));
if (HighLevelRoom.HighLevelLocDict.ContainsKey(room.position.East))
roomObj.AddExit(ExitDirection.EAST, HighLevelRoom.HighLevelLocDict[room.position.East]);
else roomObj.AddExit(ExitDirection.EAST, new HighLevelRoom("<", room.position.East));
//.........这里部分代码省略.........