Пример #1
0
        public void SetMap(MapInformations Map, bool useDiagonal)
        {
            currentMap = Map.CurrentMap;
            if (currentMap == null)
            {
                return;
            }
            useDiagonals = useDiagonal;
            matrix.Clear();
            openList.Clear();
            find = false;
            CellData cell;
            int      id   = 0;
            int      loc1 = 0;
            int      loc2 = 0;
            int      loc3 = 0;

            for (int line = 0; line < 20; line++)
            {
                for (int column = 0; column < 14; column++)
                {
                    cell = currentMap.Cells[id];
                    if (Map.Actors.ContainsKey((int)id))
                    {
                        cell.mov = false;
                    }
                    matrix.Add(id, new Cell(cell, cell.mapChangeData != 0, cell.mov, true, column, loc3, id, new Point(loc1 + column, loc2 + column)));
                    id++;
                }
                loc1++;
                loc3++;
                for (int column = 0; column < 14; column++)
                {
                    cell = currentMap.Cells[id];
                    if (Map.Actors.ContainsKey((int)id))
                    {
                        cell.mov = false;
                    }
                    matrix.Add(id, new Cell(cell, cell.mapChangeData != 0, cell.mov, true, column, loc3, id, new Point(loc1 + column, loc2 + column)));
                    id++;
                }
                loc3++;
                loc2--;
            }
        }
Пример #2
0
        public void SetMap(MapData map, bool useDiagonal)
        {
            currentMap   = map;
            useDiagonals = useDiagonal;
            matrix.Clear();
            openList.Clear();
            find = false;
            var id   = 0;
            var loc1 = 0;
            var loc2 = 0;
            var loc3 = 0;

            for (var line = 0; line < 20; line++)
            {
                CellData cell;
                for (var column = 0; column < 14; column++)
                {
                    cell = currentMap.Data.Cells[id];
                    if (!map.NoEntitiesOnCell((short)id))
                    {
                        cell.Mov = false;
                    }
                    matrix.Add(id,
                               new Cell(cell.MapChangeData != 0, cell.Mov, true, column, loc3, id,
                                        new Point(loc1 + column, loc2 + column)));
                    id++;
                }
                loc1++;
                loc3++;
                for (var column = 0; column < 14; column++)
                {
                    cell = currentMap.Data.Cells[id];
                    if (!map.NoEntitiesOnCell((short)id))
                    {
                        cell.Mov = false;
                    }
                    matrix.Add(id,
                               new Cell(cell.MapChangeData != 0, cell.Mov, true, column, loc3, id,
                                        new Point(loc1 + column, loc2 + column)));
                    id++;
                }
                loc3++;
                loc2--;
            }
        }