home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2002 September / PCPlus_193_Laplink2000.iso / Prog / c# / wombat / Adventure.cs < prev    next >
Encoding:
Text File  |  2002-05-07  |  1.9 KB  |  75 lines

  1. using System;
  2.  
  3. namespace wombat
  4. {
  5.     /// <summary>
  6.     /// The Adventure class contains the 'world' of the game:
  7.     /// the player and any other actors, plus the map.
  8.     /// </summary>
  9.     public class Adventure
  10.     {
  11.         private Actor _player;
  12.         private RoomList _map = new RoomList();
  13.  
  14.         
  15.         public Adventure()
  16.         {
  17.             //
  18.             // FOR NOW any adventure object is always an instance of the same game
  19.             // Later we can change this so that different games can be loaded
  20.             //                    
  21.  
  22.             ThingList potlist = new ThingList();
  23.             potlist.Add(new Thing("Jewel", "A lovely diamond"));
  24.             potlist.Add(new Thing("Ring", "A ring of power."));
  25.  
  26.             ThingList rm4list = new ThingList();
  27.             rm4list.Add(new Thing("Thing one","1st thing"));
  28.             rm4list.Add(new Thing("Thing two","2nd thing"));
  29.             rm4list.Add(new Thing("Thing three","3rd thing"));
  30.             rm4list.Add(new ThingHolder("a pot", "a brass container.", potlist));            
  31.  
  32.             _map.Add(new Room("room0", "A field west of a white house.", dir.NOEXIT, 2, dir.NOEXIT, 1, new ThingList()));
  33.             _map.Add(new Room("room1", "A lovely white house.", dir.NOEXIT, dir.NOEXIT, 0, dir.NOEXIT, new ThingList()));
  34.             _map.Add(new Room("room2", "A golden room hung with rich tapestries.", 0, 4, dir.NOEXIT, 3, new ThingList()));
  35.             _map.Add(new Room("room3", "A nasty dungeon.", dir.NOEXIT, 5, 2, dir.NOEXIT, new ThingList()));
  36.             _map.Add(new Room("room4", "A dark cave.", 2, dir.NOEXIT, dir.NOEXIT, 5, rm4list));
  37.             _map.Add(new Room("room5", "A sweetly scented orchard.", 3, dir.NOEXIT, 4, dir.NOEXIT, new ThingList()));
  38.                         
  39.             
  40.  
  41.             //!!! ---- add things to some rooms!!!! 
  42.             _player = new Actor("You","The Player", _map.Item(3), new ThingList());
  43.             
  44.             
  45.             
  46.     
  47.         }
  48.  
  49.         public Actor Player
  50.         {
  51.             get
  52.             {
  53.                 return _player;
  54.             }
  55.             set
  56.             {                
  57.                 _player = value;
  58.             }
  59.         } // Player
  60.  
  61.         public RoomList Map
  62.         {
  63.             get
  64.             {
  65.                 return _map;
  66.             }
  67.             set
  68.             {                
  69.                 _map = value;
  70.             }
  71.         } // Map
  72.  
  73.     } // Adventure
  74. }
  75.