Example #1
0
        public RPGArea(string AreaFileName)
        {
            if (AreaFileName == null || AreaFileName.Length < 3)
            {
                AreaFileName = DEFAULT_AREA;
            }

            this.ID = AreaFileName;

            RPGObjects = new RPGObject[MAX_AREA_OBJECTS];
            Effects    = new RPGEffect[MAX_AREA_EFFECTS];

            // add player to area
            Session.thisSession.player.Location = new Point(700, 250);
            RPGObjects[GetObjSlot()]            = Session.thisSession.player;

            // add other random people.
            for (int i = 0; i < 1; i++)
            {
                Actor a = Actor.CreateRandomRobber();
                a.Location = new Point(20, 50);
                RPGObjects[GetObjSlot()] = a;
            }
            for (int i = 0; i < 3; i++)
            {
                Actor a = Actor.CreateRandomThug();
                a.Location = new Point(20 + 20 * i, 100 + 100 * i);
                RPGObjects[GetObjSlot()] = a;
            }
            for (int i = 0; i < 5; i++)
            {
                RPGObjects[GetObjSlot()] = Actor.CreateRandomArcher();
            }

            // read file and load data into memory
            try
            {
                LoadFile(System.IO.File.ReadAllText(AREA_PATH + ID + ".area"));
            }
            catch (Exception e)
            {
                e.ToString();
            }
        }