public void RegenerateMap() { using (Instrumenter.Start()) { var mapSize = GetMapSize(); map = new Cell[mapSize, mapSize]; var noise = new FastNoiseLite(Guid.NewGuid().GetHashCode()); noise.SetNoiseType(FastNoiseLite.NoiseType.OpenSimplex2); noise.SetFrequency(0.01f); noise.SetFractalType(FastNoiseLite.FractalType.FBm); var height = noise.GetNoiseMap(mapSize); for (var x = 0; x < mapSize; x++) { for (var z = 0; z < mapSize; z++) { var cellHeight = height[x, z] * 20f; if (cellHeight <= 0) { cellHeight = 0; } Color color; if (cellHeight > 9) { color = Color.white; } else if (cellHeight > 7) { color = Color.grey; } else if (cellHeight > 5) { color = ColorExtensions.GetColorFromHex("2d6a4f"); } else if (cellHeight > 2) { color = ColorExtensions.GetColorFromHex("52b788"); } else if (cellHeight > 0) { color = Color.yellow; } else { color = Color.blue; } map[x, z] = new Cell(x, z, cellHeight, color); } } Locate <ChunkManager>().RenderCells(map); } }
public static Color GetActualColor(this CardColor cardColor) { return(cardColor switch { CardColor.Blue => ColorExtensions.GetColorFromHex("337DC1"), CardColor.Red => ColorExtensions.GetColorFromHex("DF0101"), CardColor.Yellow => ColorExtensions.GetColorFromHex("FFC20A"), CardColor.Green => ColorExtensions.GetColorFromHex("5AA300"), _ => Color.magenta, });
private ChunkCell[,] GetCells() { var cells = new ChunkCell[_size, _size]; var waterCol = ColorExtensions.GetColorFromHex("7f7e7d"); for (int x = 0; x < _size; x++) { for (int y = 0; y < _size; y++) { var height = _heightMap[x, y]; cells[x, y] = new ChunkCell(x, y, height, height > 0 ? GetBiome(_temperatureMap[x, y], _moistureMap[x, y]) : waterCol); } } Pathfinder.LinkCellsToNeighbors(cells, _size); return(cells); }
private void Initialize(Structure structure) { RefreshSpreadDelta(structure); InstantiateFlames(structure); if (structure.BaseFlammability > 150) { Loc.GetVisualEffectController().CreateFireLight(_flameMesh.transform, ColorExtensions.GetColorFromHex("F5810E"), 25, 25, 0.5f); } }