Exemple #1
0
 public MapData(GenerateMap generate, int seed, int size)
 {
     data_dir = string.Format("map_{0}_{1}", seed, size);
     if (!Directory.Exists(data_dir))
     {
         Directory.CreateDirectory(data_dir);
     }
     this.generate = generate;
 }
Exemple #2
0
        public      SpaceData[] GetGrounds()
        {
            GenerateMap generate = GenerateMap.instance;

            SpaceData[] result;
            if (space_id < generate.citys.Length)
            {
                // 是城市
                result    = new SpaceData[2];
                result[1] = generate.citys[space_id];
            }
            else
            {
                // 森林
                result = new SpaceData[1];
            }
            result[0] = generate.grounds[space_id * 2 + 1];
            return(result);
        }
Exemple #3
0
        public int player_count; // 这个区域拥有的玩家数量

        public GenerateArea(int area_id, GenerateMap generate, SpaceData groundData, SpaceData spaceData, SpaceData waterData)
        {
            this.player_count = 1;
            this.area_id      = area_id;
            this.generate     = generate;
            this.groundData   = groundData;
            this.spaceData    = spaceData;
            city_rects        = new float[generate.citys.Length][];
            for (int i = 0; i < generate.citys.Length; i++)
            {
                var item = generate.citys[i];
                city_rects[i] = new float[] { item.min_x, item.min_z, item.max_x, item.max_z };
            }
            city_height   = generate.city_height + 1;
            ground_height = generate.ground_height + 1;
            thread        = new Thread(Generate);
            thread.Start();

            CreateAreaGameObject(groundData);
            CreateAreaGameObject(spaceData);
            CreateAreaGameObject(waterData);
        }
Exemple #4
0
 private void Awake()
 {
     instance = this;
     Init();
 }