コード例 #1
0
    /// <summary>
    /// マップ表示
    /// </summary>
    /// <param name="mapNum">対応するマップ番号</param>
    private void InitMapData(int mapNum)
    {
        _dungeonRegistry.LoadModelData(_mapDataFileNames[mapNum]);
        _mapSize = _dungeonRegistry.MapModel.mapSize;
        var startX = (_mapSize.x / 2) * -180 + (((_mapSize.x % 2) == 0) ? 90 : 0);
        var startY = (_mapSize.y / 2) * 180 + (((_mapSize.y % 2) == 0) ? -90 : 0);

        foreach (var y in (Enumerable.Range(0, (int)_mapSize.y)))
        {
            foreach (var x in Enumerable.Range(0, (int)_mapSize.x))
            {
                var mapData    = _dungeonRegistry.MapModel.mapData[y].mapData[x];
                var atlasIndex = mapData.mapSrcNum;
                var imageIndex = mapData.mapSrcPos.y * 4 + mapData.mapSrcPos.x;
                _mapChipPresenter.AddMapChip(startX + x * 180, startY - y * 180, atlasIndex, imageIndex, TapCard);
            }
        }
    }
コード例 #2
0
    /// <summary>
    /// マップ表示
    /// </summary>
    /// <param name="mapNum">対応するマップ番号</param>
    private void InitMapData(int mapNum)
    {
        _dungeonRegistry.LoadModelData(_mapDataFileNames[mapNum]);
        _mapSize = _dungeonRegistry.MapModel.mapSize;
        var startX = (float)((_mapSize.x + 1) / 2) * -1f;
        var startY = (float)((_mapSize.y + 1) / 2) * 1f;

        foreach (var y in (Enumerable.Range(0, (int)_mapSize.y)))
        {
            foreach (var x in Enumerable.Range(0, (int)_mapSize.x))
            {
                var mapData    = _dungeonRegistry.MapModel.mapData[y].mapData[x];
                var atlasIndex = mapData.mapSrcNum;
                var imageIndex = new Vector2Int(mapData.mapSrcPos.x, mapData.mapSrcPos.y);
                _mapChip3DPresenter.AddMapChip(startX + (float)x * 1f, startY - (float)y * 1f, atlasIndex, imageIndex, TapCard);
            }
        }
    }