Пример #1
0
        private IEnumerator CreateLayers()
        {
            GameMapData gmap = GameMgmt.Get().data.map;

            //load layer
            //Levels = new List<OldGameMapLevel>();
            for (int i = 0; i < gmap.levels.Count; i++)
            {
                //OldGameMapLevel g = new OldGameMapLevel(i);
                //Levels.Add(g);
                //yield return g.AddLayers();
            }

            yield return(AddBorder());
        }
Пример #2
0
        private void CalcGrid(Player player, string moveType)
        {
            GameMapData      gmap  = GameMgmt.Get().data.map;
            GameMapDataLevel level = GameMgmt.Get().newMap[_id].dataLevel;

            float[,] costMap = new float[gmap.width, gmap.height];

            for (int x = 0; x < gmap.width; x++)
            {
                for (int y = 0; y < gmap.height; y++)
                {
                    costMap[x, y] = L.b.modifiers[C.MoveCost].CalcModi(level.Terrain(x, y).MoveCost(moveType), player,
                                                                       new NVector(x, y, _id));// level.Terrain(x, y).MoveCost(moveType, nation);
                    //Debug.LogWarning($"Cost for {X},{Y} for {nation}-{moveType} is {costMap[x,y]}");
                }
            }

            _grids[Key(player, moveType)] = new PGrid(costMap);
        }
Пример #3
0
        // Update is called once per frame
        public IEnumerator LoadMap(DataMap map)
        {
            yield return(GameMgmt.Get().load.ShowSubMessage($"Loading Map data"));

            //read data
            GameMapData gmap = GameMgmt.Get().data.map;
            IniData     data = map.Config();

            //add level
            foreach (SectionData section in data.Sections)
            {
                GameMapDataLevel n = new GameMapDataLevel();
                n.name = section.SectionName;
                yield return(GameMgmt.Get().load.ShowSubMessage($"Reading {n.name} map data"));

                if (data[section.SectionName].ContainsKey("standard"))
                {
                    gmap.standard = gmap.levels.Count();
                }

                //add layer
                int m = Int32.Parse(data[section.SectionName]["layer"]);
                for (int i = 0; i < m; i++)
                {
                    n.AddLayer(map.Layer(data[section.SectionName]["format"], i));
                    yield return(GameMgmt.Get().load.ShowSubMessage($"Reading {n.name} map data {i}/{m}"));
                }
                gmap.levels.Add(n);
            }

            //set size
            gmap.width  = gmap.levels.First().Width();
            gmap.height = gmap.levels.First().Height();

            Debug.Log($"Load Map {map.Name()} ({gmap.width}/{gmap.height})");

            yield return(CreateLayers());
        }