private void InvokeLoadService(ImmutableArray <TData> datas, MapConfig config) { var service = GetService(); service.Load( datas, config.GetMap2DActualWidth(), config.GetMap2DActualHeight() ); }
public Coordinate GetCoordinateFromFlattenArrayIndex(int index, MapConfig config) { if (index > config.GetTotalMapSize() || index < 0) { throw new ArgumentOutOfRangeException($"{index} is out of range of the given config: ${config}"); } var nestedArrayZ = index / config.GetMap2DActualHeight(); var nestedArrayX = index - nestedArrayZ * config.GetMap2DActualWidth(); return(GetAxialCoordinateFromNestedArrayIndex(nestedArrayX, nestedArrayZ)); }
private static TileHolder[,] Create2DTileHolders(IReadOnlyList <TileHolder> tileHolders, MapConfig mapConfig) { var mapXSize = mapConfig.GetMap2DActualWidth(); var mapZSize = mapConfig.GetMap2DActualHeight(); var toReturn = new TileHolder[mapXSize + mapZSize / 2, mapZSize]; for (var i = 0; i < mapZSize; i++) { for (var j = 0; j < mapXSize; j++) { toReturn[j + i % 2 + i / 2, i] = tileHolders[i * mapXSize + j]; } } return(toReturn); }
private static IReadOnlyList <Vector3> CreateData(MapConfig mapConfig, WorldConfig worldConfig, float yPosition) { var toReturn = new List <Vector3>(); var upDistance = worldConfig.OuterRadius * 1.5f; var sideDistance = worldConfig.InnerRadius * 2f; for (var i = 0; i < mapConfig.GetMap2DActualHeight(); i++) { var sideOffset = i % 2 * sideDistance / 2f; for (var j = 0; j < mapConfig.GetMap2DActualWidth(); j++) { toReturn.Add( new Vector3( j * sideDistance + sideOffset, yPosition, i * upDistance ) ); } } return(toReturn); }