Exemple #1
0
        public World()
        {
            Random rnd = new Random();

            #if SILVERLIGHT
            Res.SearchPath.addPath("file://K:/Projects/steel/moora/Resources");
            //            dirs.Add("http://division.kindex.lv/moora/terrain");
            #else
            Res.SearchPath.addPath("../../../Resources");
            Res.SearchPath.addPath("Resources");
            #endif
            terrain = new Terrain(rnd);
            //            map = new RandomMap(21, 18, terrain, rnd);

            List<string> file = Res.TextFile.GetTextFile("map.txt");

            map = new FileMap(terrain, file);

            int char_x;
            int char_y;

            int try_number = 0;
            do
            {
                char_x = rnd.Next(0, map.X);
                char_y = rnd.Next(0, map.Y);
                if (try_number++ > 1000)
                {
                    break;
                }
            }
            while (map.getTerrain(char_x, char_y) != TerrainType.Sand);

            character = new Character(char_x, char_y, map);
        }