当前位置: 首页>>代码示例>>C#>>正文


C# IRoom.AddExit方法代码示例

本文整理汇总了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));
//.........这里部分代码省略.........
开发者ID:Arandmoor,项目名称:February-ProcGen-Challenge,代码行数:101,代码来源:HighLevelRoomConfigurator.cs


注:本文中的IRoom.AddExit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。