示例#1
0
    private void NodeScatter(Vector3Int location, OreProbability materialSpecified)
    {
        var locations = new List <Vector3Int>()
        {
            location,
        };
        var strength = materialSpecified.PossibleClusterSizes[RANDOM.Next(materialSpecified.PossibleClusterSizes.Count)];

        while (strength > 0)
        {
            var chosenLocation = locations[RANDOM.Next(locations.Count)];
            var ranLocation    = chosenLocation + DIRECTIONS[RANDOM.Next(DIRECTIONS.Count)];
            if (wallTilemap.GetTile(ranLocation) != null)
            {
                tileChangeManager.UpdateTile(ranLocation, materialSpecified.WallTile);
                locations.Add(ranLocation);
                ranLocation.z = -1;
                tileChangeManager.UpdateTile(ranLocation, materialSpecified.OverlayTile);
            }
            strength--;
        }
    }
示例#2
0
    private void NodeScatter(Vector3Int location, OreProbability materialSpecified)
    {
        var locations = new List <Vector3Int>()
        {
            location,
        };
        var strength = materialSpecified.PossibleClusterSizes[RANDOM.Next(materialSpecified.PossibleClusterSizes.Count)];

        while (strength > 0)
        {
            var chosenLocation = locations[RANDOM.Next(locations.Count)];
            var ranLocation    = chosenLocation + DIRECTIONS[RANDOM.Next(DIRECTIONS.Count)];
            var tile           = metaTileMap.GetTile(ranLocation);
            if (tile != null && tile.name.Contains("rock_wall"))
            {
                tileChangeManager.MetaTileMap.SetTile(ranLocation, materialSpecified.WallTile);
                locations.Add(ranLocation);
                ranLocation.z = -1;
                tileChangeManager.MetaTileMap.AddOverlay(ranLocation, materialSpecified.OverlayTile as OverlayTile);
            }
            strength--;
        }
    }