Backend object representing a room in the game
Inheritance: IHandleEvent, IDisposable
Esempio n. 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="parent">A local event handler to send messages to</param>
 /// <param name="network">The network connection to use for handling events</param>
 public NetLogic(IHandleEvent parent, NetPlayer network)
     : base(parent, null, null)
 {
     _network = network;
     network.parent = this;
     _map = new Map();
 }
Esempio n. 2
0
 public Logic(IHandleEvent parent, Map map = null, Random random = null)
 {
     _parent = parent;
     if (map != null)
     {
         _map = map;
     }
     if (random == null) _random = new Random();
     else _random = random;
 }
Esempio n. 3
0
        /// <summary>
        /// The constructor for the logic behind the game
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="map">The map object which will contain the rooms</param>
        /// <param name="_random">A random</param>
        public PureLogic(IHandleEvent parent, Map map = null, Random _random = null)
            : base(parent, map, _random)
        {
            if (!System.IO.File.Exists("save\\auto\\room1.xml"))
            {
                GenerateMaps();
            }

            string path = "room1.xml";
            if (File.Exists("save\\auto\\GameData"))
                path = File.ReadAllText("save\\auto\\GameData");
            if (path.IndexOf(Environment.NewLine) > 0)
            {
                path = path.Substring(0, path.IndexOf(Environment.NewLine));
            }
            if (File.Exists("save\\auto\\saved" + (string)path))
                _map = new Map(this, "saved" + (string)path);
            else
                _map = new Map(this, (string)path);
        }