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


C# Location.addExit方法代码示例

本文整理汇总了C#中Location.addExit方法的典型用法代码示例。如果您正苦于以下问题:C# Location.addExit方法的具体用法?C# Location.addExit怎么用?C# Location.addExit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Location的用法示例。


在下文中一共展示了Location.addExit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Game

        public Game()
		{
            inventory = new List<Item>();

			Console.WriteLine("Welcome adventurer, prepare yourself for a fantastical journey into the unknown.");

            // build the "map"
            // add locations and items
            // currently items must only be one word, spaces will break them

            Location l1_a1 = new Location("The Car", "You are at the end of a long alleyway, behind the car is a sheer drop, best not go that way.");// crashed car
            Key l1_screwDriver = new Key("Screw Driver", "This might come in handy.", false);
            l1_a1.addItem(l1_screwDriver);

            Location l1_a2 = new Location("The Alleyway", "A dark alleyway leading north to a gate and south to the car.");
            Key l1_brokenPipe = new Key("Broken Pipe", "A piece of steel piping, it looks like it broke off of the piping above.", true);
            l1_a2.addItem(l1_brokenPipe);

            Location l2_a1 = new Location("End of the alleyway", "There is a Metal gate standing North of you,\nblocking the exit from the alleyway.\nA Rusted chain with a Damaged Lock on it.\nIt looks like it could be easily broken with something...");// gate at end locking the exit

            Location l3_a1 = new Location("Barricaded Street", "A wide street with barricades not far east and west blocking the roads.\nThe street is surrounded by tall buildings.");

            l1_a1.addExit(new Exit(Exit.Directions.North, l1_a2));

            l1_a2.addExit(new Exit(Exit.Directions.South, l1_a1));
            l1_a2.addExit(new Exit(Exit.Directions.North, l2_a1));

            l2_a1.addExit(new Exit(Exit.Directions.South, l1_a2));
            l2_a1.addExit(new Exit(Exit.Directions.North, l3_a1, l1_brokenPipe));

            l3_a1.addExit(new Exit(Exit.Directions.South, l2_a1));

            currentLocation = l1_a1;

            showLocation(false);
		}
开发者ID:Tezza48,项目名称:Programming_TextAdventure,代码行数:36,代码来源:Game.cs


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