public void InitializeHashGrid(int seed) { _hashGrid = new TileHash[HashGridSize * HashGridSize]; Random.State currentState = Random.state; Random.InitState(seed); for (int i = 0; i < _hashGrid.Length; i++) { _hashGrid[i] = TileHash.Create(); } Random.state = currentState; }
public void AddFeature(TerrainTile tile, Vector3 position) { TileHash hash = SampleHashGrid(position); if (hash.a > 0.5 * tile.FeatureProbability) { return; } Transform instance = Instantiate(FeaturePrefab); instance.localPosition = position; instance.localRotation = Quaternion.Euler(0f, 360f * hash.b, 0f); instance.SetParent(_container, false); tile.HasFeature = true; }