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