Map generation tweaking: some biomes are placed at the center of the map, some at the center and some randomly.

This commit is contained in:
Joonas Rikkonen
2017-08-20 13:20:23 +03:00
parent 8e71b4b828
commit a6689b894d
5 changed files with 110 additions and 16 deletions
@@ -8,9 +8,18 @@ namespace Barotrauma
{
class Biome
{
public enum MapPlacement
{
Random = 1,
Center = 2,
Edge = 4
}
public readonly string Name;
public readonly string Description;
public readonly MapPlacement Placement;
public Biome(string name, string description)
{
Name = name;
@@ -21,6 +30,17 @@ namespace Barotrauma
{
Name = ToolBox.GetAttributeString(element, "name", "Biome");
Description = ToolBox.GetAttributeString(element, "description", "");
string[] placementsStrs = ToolBox.GetAttributeString(element, "MapPlacement", "Default").Split(',');
foreach (string placementStr in placementsStrs)
{
MapPlacement parsedPlacement;
if (Enum.TryParse(placementStr.Trim(), out parsedPlacement))
{
Placement |= parsedPlacement;
}
}
}
}