Commit 2f121c4a authored by Nina's avatar Nina
Browse files

Changed some comments and renamed some classes

parent 286cae0b
......@@ -14,7 +14,7 @@ namespace Civ2.MapGeneration.ConceptualMap
{
}
public static Map<TypeName> GenerateLandMass(int width, int height, double continentProportion)
public static Map<TerrainType> GenerateLandMass(int width, int height, double continentProportion)
{
/* The algorithm is the one from https://forums.civfanatics.com/threads/civ1-geographyMap-generation-explained.498630/#mapgenA ,
* steps 1 to 3 and slightly variated.
......@@ -63,7 +63,7 @@ namespace Civ2.MapGeneration.ConceptualMap
* # Generate new land mass until the specified number of continent tiles has been generated. #
*/
Map<TypeName> geographyMap = new Map<TypeName>(width, height, TypeName.OZEAN);
Map<TerrainType> geographyMap = new Map<TerrainType>(width, height, TerrainType.OZEAN);
int margin = 4; // width - 2 * margin must be divisible by 2
int widthMapWithMargin = width - 2 * margin;
if (widthMapWithMargin % 2 != 0)
......@@ -80,10 +80,10 @@ namespace Civ2.MapGeneration.ConceptualMap
}
int currentNumberContinentTiles = 0;
Map<TypeName> stencilMap;
Map<TerrainType> stencilMap;
while (currentNumberContinentTiles < targetNumberContinentTiles)
{
stencilMap = new Map<TypeName>(width, height, TypeName.OZEAN);
stencilMap = new Map<TerrainType>(width, height, TerrainType.OZEAN);
Vector2Int coord = stencilMap.GetRandomCoordInMap(0.1);
int x = coord.x;
int y = coord.y;
......@@ -91,9 +91,9 @@ namespace Civ2.MapGeneration.ConceptualMap
while (pathLength != 0 && stencilMap.IsInMapWithMargin(x, y, margin))
{
stencilMap.Set(x, y, TypeName.WIESE);
stencilMap.Set(x + 1, y, TypeName.WIESE);
stencilMap.Set(x, y + 1, TypeName.WIESE);
stencilMap.Set(x, y, TerrainType.WIESE);
stencilMap.Set(x + 1, y, TerrainType.WIESE);
stencilMap.Set(x, y + 1, TerrainType.WIESE);
--pathLength;
int nextPosition = Util.GetRandom().Next(0, 4);
......@@ -118,20 +118,20 @@ namespace Civ2.MapGeneration.ConceptualMap
return geographyMap;
}
private static int MergeChunkToMainGeography(Map<TypeName> stencilMap, Map<TypeName> map, int currentNumberContinentTiles)
private static int MergeChunkToMainGeography(Map<TerrainType> stencilMap, Map<TerrainType> map, int currentNumberContinentTiles)
{
foreach (Pair<TypeName, Vector2Int> next in stencilMap)
foreach (Pair<TerrainType, Vector2Int> next in stencilMap)
{
TypeName type = next.GetFirst();
TerrainType type = next.GetFirst();
Vector2Int coord = next.GetSecond();
if (type == TypeName.WIESE)
if (type == TerrainType.WIESE)
{
int x = coord.x;
int y = coord.y;
if (map.Get(x, y) == TypeName.OZEAN)
if (map.Get(x, y) == TerrainType.OZEAN)
{
++currentNumberContinentTiles;
map.Set(x, y, TypeName.WIESE);
map.Set(x, y, TerrainType.WIESE);
}
}
}
......
......@@ -19,11 +19,11 @@ namespace Civ2.MapGeneration.ConceptualMap
/// 2. the lower bound for the length of the patterns
/// 3. the upper bound for the length of the patterns
/// 4. the probability for a change of the "pattern direction"
/// 5. the type of a tile adjacent to the starting tile of the pattern (e.g. TypeName.OZEAN for TypeName.Fluss, TypeName.WIESE if irrelevant where pattern begins)
/// 5. the type of a tile adjacent to the starting tile of the pattern (e.g. TerrainType.OZEAN for TerrainType.Fluss, TerrainType.WIESE if irrelevant where pattern begins)
/// </param>
public static void CreatePatterns(Map<TypeName> map, Dictionary<TypeName, (int, int, int, double, TypeName)> patternData)
public static void CreatePatterns(Map<TerrainType> map, Dictionary<TerrainType, (int, int, int, double, TerrainType)> patternData)
{
foreach (KeyValuePair<TypeName, (int, int, int, double, TypeName)> entry in patternData)
foreach (KeyValuePair<TerrainType, (int, int, int, double, TerrainType)> entry in patternData)
{
CreatePatterns(entry.Key, entry.Value.Item1, entry.Value.Item2, entry.Value.Item3, entry.Value.Item4, entry.Value.Item5, map);
}
......@@ -49,10 +49,10 @@ namespace Civ2.MapGeneration.ConceptualMap
/// compact the patterns will be.
/// </param>
/// <param name="typeAdjacentToStartingPosition">
/// The type of a tile adjacent to the starting tile of the pattern (e.g. TypeName.OZEAN for TypeName.Fluss,
/// TypeName.WIESE if irrelevant where pattern begins).
/// The type of a tile adjacent to the starting tile of the pattern (e.g. TerrainType.OZEAN for TerrainType.Fluss,
/// TerrainType.WIESE if irrelevant where pattern begins).
/// </param>
private static void CreatePatterns(TypeName patternType, int targetNumberTiles, int patternLengthLowerBound, int patternLengthUpperBound, double probabilityChangeOfDirection, TypeName typeAdjacentToStartingPosition, Map<TypeName> map)
private static void CreatePatterns(TerrainType patternType, int targetNumberTiles, int patternLengthLowerBound, int patternLengthUpperBound, double probabilityChangeOfDirection, TerrainType typeAdjacentToStartingPosition, Map<TerrainType> map)
{
// generate patterns until the specified number of tiles has been set
// to the specified type
......@@ -64,13 +64,13 @@ namespace Civ2.MapGeneration.ConceptualMap
}
/// <summary>
/// method must only be called if there is at least one TypeName.WIESE tile
/// method must only be called if there is at least one TerrainType.WIESE tile
/// <returns>
/// Length of the created pattern (since the map can already be quite "full", the actual length of the created
/// pattern might be lower than the specified one
/// </returns>
/// </summary>
private static int CreatePattern(TypeName patternType, int targetPatternLength, double probabilityChangeOfDirection, TypeName typeAdjacentToStartingPosition, Map<TypeName> map)
private static int CreatePattern(TerrainType patternType, int targetPatternLength, double probabilityChangeOfDirection, TerrainType typeAdjacentToStartingPosition, Map<TerrainType> map)
{
int currentTry = 1; // Several attempts to find a pattern of the specified length are made
// (since the map can already be quite "full", some starting positions can lead to patterns that
......@@ -89,10 +89,10 @@ namespace Civ2.MapGeneration.ConceptualMap
// expand pattern
for (int i = 0; pattern.Count != targetPatternLength; i++)
{
// 1. Find the next possible coordinates (coordinates that are of type TypeName.WIESE and are adjacent
// 1. Find the next possible coordinates (coordinates that are of type TerrainType.WIESE and are adjacent
// to a coordinate that has been previously added to the pattern).
// Take the neighbors of the coordinate that was most recently added to the pattern and has
// at least one adjacent coordinate that is of type TypeName.WIESE.
// at least one adjacent coordinate that is of type TerrainType.WIESE.
List<Vector2Int> nextPossibleCoordinates = new List<Vector2Int>(0);
for (int idx = pattern.Count - 1; nextPossibleCoordinates.Count == 0 && idx >= 0; idx--)
{
......@@ -181,16 +181,16 @@ namespace Civ2.MapGeneration.ConceptualMap
}
/// <summary>
/// This method determines starting position for the pattern that is of type TypeName.WIESE and adjacent to a tile
/// This method determines starting position for the pattern that is of type TerrainType.WIESE and adjacent to a tile
/// of the specified type.
/// </summary>
private static Vector2Int GetStartingPosition(Map<TypeName> map, TypeName typeAdjacentToStartingPosition)
private static Vector2Int GetStartingPosition(Map<TerrainType> map, TerrainType typeAdjacentToStartingPosition)
{
List<Vector2Int> possibleStartPositions = new List<Vector2Int>(map.GetNumberTiles() / 20);
foreach (Pair<TypeName, Vector2Int> entry in map)
foreach (Pair<TerrainType, Vector2Int> entry in map)
{
Vector2Int candidate = entry.GetSecond();
if (entry.GetFirst().Equals(TypeName.WIESE))
if (entry.GetFirst().Equals(TerrainType.WIESE))
{
// check if one adjacent tile has the specified starting type
if (map.Get(candidate.x - 1, candidate.y).Equals(typeAdjacentToStartingPosition)
......@@ -210,9 +210,9 @@ namespace Civ2.MapGeneration.ConceptualMap
/// <summary>
/// This method returns a list of the adjacent coordinates of the specified one
/// for which TypeName.WIESE is stored in the specified map.
/// for which TerrainType.WIESE is stored in the specified map.
/// </summary>
private static List<Vector2Int> GetNextPossibleCoordinates(int x, int y, Map<TypeName> map)
private static List<Vector2Int> GetNextPossibleCoordinates(int x, int y, Map<TerrainType> map)
{
List<Vector2Int> nextPossibleCoordinates = new List<Vector2Int>(4);
......@@ -226,13 +226,13 @@ namespace Civ2.MapGeneration.ConceptualMap
/// <summary>
/// This method adds the specified coordinate to the specified list if the coordinate is in the map
/// and the map stores TypeName.WIESE at this position.
/// and the map stores TerrainType.WIESE at this position.
/// </summary>
private static void AddIfPossibleNextCoordinate(int x, int y, List<Vector2Int> nextPossibleCoordinates, Map<TypeName> map)
private static void AddIfPossibleNextCoordinate(int x, int y, List<Vector2Int> nextPossibleCoordinates, Map<TerrainType> map)
{
try
{
if (map.Get(x, y) == TypeName.WIESE)
if (map.Get(x, y) == TerrainType.WIESE)
{
nextPossibleCoordinates.Add(new Vector2Int(x, y));
}
......
using Civ2.MapGeneration.ConceptualMap;
using static Civ2.MapGeneration.ConceptualMap.ResourceName;
using static Civ2.MapGeneration.ConceptualMap.TypeName;
namespace Assets.Scripts.MapGeneration.ConceptualMap

namespace Civ2.MapGeneration.ConceptualMap
{
public class Resource
public enum Resource
{
public static Resource[] resources = new Resource[]
{
new Resource(BUEFFEL, PRAERIE),
new Resource(KOHLE, HUEGEL),
new Resource(FISCH, OZEAN),
new Resource(FRUECHTE, DSCHUNGEL),
new Resource(PELZE, TUNDRA),
new Resource(WILD_F, FORST),
new Resource(WILD_T, TUNDRA),
new Resource(EDELSTEINE, DSCHUNGEL),
new Resource(GOLD, BERGE),
new Resource(GRASLAENDER, WIESE),
new Resource(EISEN, BERGE),
new Resource(ELFENBEIN, GLETSCHER),
new Resource(OASE, WUESTE),
new Resource(OEL_W, WUESTE),
new Resource(OEL_G, GLETSCHER),
new Resource(TORF, SUMPF),
new Resource(SEIDE, FORST),
new Resource(GEWUERZE, SUMPF),
new Resource(WALFISCHE, OZEAN),
new Resource(WEIZEN, PRAERIE),
new Resource(WEIN, HUEGEL),
};
public ResourceName resourceName;
public TypeName typeName;
public Resource(ResourceName resourceName, TypeName typeName)
{
this.resourceName = resourceName;
this.typeName = typeName;
}
NONE,
BUEFFEL,
KOHLE,
FISCH,
FRUECHTE,
PELZE,
WILD_F,
WILD_T,
EDELSTEINE,
GOLD,
GRASLAENDER,
EISEN,
ELFENBEIN,
OASE,
OEL_W,
OEL_G,
TORF,
SEIDE,
GEWUERZE,
WALFISCHE,
WEIZEN,
WEIN
}
}
......@@ -11,14 +11,14 @@ namespace Civ2.MapGeneration.ConceptualMap
/// <summary>
/// Returns a map with special resources.
/// </summary>
public static Map<ResourceName> GenerateResources(Map<TypeName> typemap)
public static Map<Resource> GenerateResources(Map<TerrainType> typemap)
{
Map<ResourceName> result = new Map<ResourceName>(typemap.width, typemap.height, ResourceName.NONE);
Map<Resource> result = new Map<Resource>(typemap.width, typemap.height, Resource.NONE);
// determine coordinates where the resources can be distributed
Dictionary<TypeName, List<Vector2Int>> possibleCoordinates = GetPossibleCoordinates(typemap);
Dictionary<TerrainType, List<Vector2Int>> possibleCoordinates = GetPossibleCoordinates(typemap);
foreach (Resource resource in Resource.resources)
foreach (ResourceInfo resource in ResourceInfo.resources)
{
// determine number of resources to distribute
int targetNumberSpecialResources = GetNumberSpecialResources(possibleCoordinates[resource.typeName].Count);
......@@ -43,18 +43,18 @@ namespace Civ2.MapGeneration.ConceptualMap
}
/// <summary>
/// This method determines for each TypeName which coordinates in the specified map have been assigned that type.
/// This method determines for each TerrainType which coordinates in the specified map have been assigned that type.
/// These coordinates can be assigned the resources belonging to the type.
/// </summary>
private static Dictionary<TypeName, List<Vector2Int>> GetPossibleCoordinates(Map<TypeName> map)
private static Dictionary<TerrainType, List<Vector2Int>> GetPossibleCoordinates(Map<TerrainType> map)
{
TypeName[] types = (TypeName[])Enum.GetValues(typeof(TypeName));
Dictionary<TypeName, List<Vector2Int>> result = new Dictionary<TypeName, List<Vector2Int>>(types.Length);
foreach (TypeName type in types)
TerrainType[] types = (TerrainType[])Enum.GetValues(typeof(TerrainType));
Dictionary<TerrainType, List<Vector2Int>> result = new Dictionary<TerrainType, List<Vector2Int>>(types.Length);
foreach (TerrainType type in types)
{
result.Add(type, new List<Vector2Int>());
}
foreach (Pair<TypeName, Vector2Int> entry in map)
foreach (Pair<TerrainType, Vector2Int> entry in map)
{
result[entry.GetFirst()].Add(entry.GetSecond());
}
......
using Civ2.MapGeneration.ConceptualMap;
using static Civ2.MapGeneration.ConceptualMap.Resource;
using static Civ2.MapGeneration.ConceptualMap.TerrainType;
namespace Assets.Scripts.MapGeneration.ConceptualMap
{
public class ResourceInfo
{
public static ResourceInfo[] resources = new ResourceInfo[]
{
new ResourceInfo(BUEFFEL, PRAERIE),
new ResourceInfo(KOHLE, HUEGEL),
new ResourceInfo(FISCH, OZEAN),
new ResourceInfo(FRUECHTE, DSCHUNGEL),
new ResourceInfo(PELZE, TUNDRA),
new ResourceInfo(WILD_F, FORST),
new ResourceInfo(WILD_T, TUNDRA),
new ResourceInfo(EDELSTEINE, DSCHUNGEL),
new ResourceInfo(GOLD, BERGE),
new ResourceInfo(GRASLAENDER, WIESE),
new ResourceInfo(EISEN, BERGE),
new ResourceInfo(ELFENBEIN, GLETSCHER),
new ResourceInfo(OASE, WUESTE),
new ResourceInfo(OEL_W, WUESTE),
new ResourceInfo(OEL_G, GLETSCHER),
new ResourceInfo(TORF, SUMPF),
new ResourceInfo(SEIDE, FORST),
new ResourceInfo(GEWUERZE, SUMPF),
new ResourceInfo(WALFISCHE, OZEAN),
new ResourceInfo(WEIZEN, PRAERIE),
new ResourceInfo(WEIN, HUEGEL),
};
public Resource resourceName;
public TerrainType typeName;
public ResourceInfo(Resource resourceName, TerrainType typeName)
{
this.resourceName = resourceName;
this.typeName = typeName;
}
}
}
fileFormatVersion: 2
guid: 28d628f984fa5e44cb1a7be8118503df
guid: 1d28faa8d99ece54ba6fa130921253f8
MonoImporter:
externalObjects: {}
serializedVersion: 2
......

namespace Civ2.MapGeneration.ConceptualMap
{
public enum ResourceName
{
NONE,
BUEFFEL,
KOHLE,
FISCH,
FRUECHTE,
PELZE,
WILD_F,
WILD_T,
EDELSTEINE,
GOLD,
GRASLAENDER,
EISEN,
ELFENBEIN,
OASE,
OEL_W,
OEL_G,
TORF,
SEIDE,
GEWUERZE,
WALFISCHE,
WEIZEN,
WEIN
}
}
......@@ -4,7 +4,7 @@ namespace Civ2.MapGeneration.ConceptualMap
/// <summary>
/// This enum contains the possible types in civilization maps.
/// </summary>
public enum TypeName
public enum TerrainType
{
WUESTE,
FORST,
......
fileFormatVersion: 2
guid: b01c520e480c5914583a08e0b0f781e8
guid: b087dbc36df378046b62ee25461cfe69
MonoImporter:
externalObjects: {}
serializedVersion: 2
......
......@@ -3,6 +3,10 @@ using System.Collections.Generic;
namespace Assets.Scripts.MapGeneration.UnityMap
{
/// <summary>
/// A CivTile is used for mapping terrain types and resources to tiles. For this purpose, arrays of CivTile are used because
/// they appear in the inspector, and for better access the arrays can be converted to dictionaries.
/// </summary>
[Serializable]
public class CivTile<K, V>
{
......@@ -12,7 +16,7 @@ namespace Assets.Scripts.MapGeneration.UnityMap
/// <summary>
/// This method is used to convert an array of TypeTile to a dictionary because in contrast to dictionaries, arrays
/// This method is used to convert an array of CivTile to a dictionary because in contrast to dictionaries, arrays
/// appear in the Unity inspector, but dictionaries are advantageous for access.
/// </summary>
public static Dictionary<K, V> GetDictionaryFromArray(CivTile<K, V>[] array)
......
......@@ -9,7 +9,7 @@ namespace Assets.Scripts.MapGeneration.UnityMap
/// (Position.ABOVE or Position.RIGHT or Position.BELOW or Position.LEFT). The tiles in the array are ordered
/// by index as follows: Depending on the types adjacent to this subtile, the index is computed by
/// treating the boolean values if the adjacent types are coast as binary numbers. The boolean values are taken clockwise,
/// the first one corresponds to the lowest significant bit.
/// the first one corresponds to the least significant bit.
/// </summary>
[Serializable]
public class CoastLineTile : CivTile<Position, Tile[]>
......
......@@ -25,17 +25,17 @@ namespace Civ2.MapGeneration.UnityMap
// The arrays are used for choosing the correct tiles.
// Convert arrays to dictionaries for better access.
public TypeBaseTile[] typeTilesArray;
private Dictionary<TypeName, Tile[]> typeTiles;
private Dictionary<TerrainType, Tile[]> typeTiles;
public CoastLineTile[] coastLineTilesArray;
private Dictionary<Position, Tile[]> coastLineTiles;
public OverlyingTile[] overlyingTilesArray;
private Dictionary<TypeName, Tile[]> overlyingTiles;
private Dictionary<TerrainType, Tile[]> overlyingTiles;
public ResourceTile[] resourceTilesArray;
private Dictionary<ResourceName, Tile> resourceTiles;
private Dictionary<Resource, Tile> resourceTiles;
private Map<TypeName> typemap;
private Map<ResourceName> specialResourceMap;
private Map<TerrainType> typemap;
private Map<Resource> specialResourceMap;
......@@ -50,13 +50,13 @@ namespace Civ2.MapGeneration.UnityMap
// generate conceptual map
typemap = LandMassGenerator.GenerateLandMass(40, 50, 0.6);
PatternGenerator.CreatePatterns(typemap, new Dictionary<TypeName, (int, int, int, double, TypeName)>(11)
PatternGenerator.CreatePatterns(typemap, new Dictionary<TerrainType, (int, int, int, double, TerrainType)>(11)
{
{ TypeName.BERGE, (130, 1, 30, 0.5, TypeName.WIESE) },
{ TypeName.OZEAN, (100, 1, 10, 0.4, TypeName.WIESE) },
{ TypeName.FORST, (100, 1, 10, 0.4, TypeName.WIESE) },
{ TypeName.DSCHUNGEL, (50, 1, 20, 0.4, TypeName.WIESE) },
{ TypeName.FLUSS, (50, 1, 5, 0.1, TypeName.OZEAN) }
{ TerrainType.BERGE, (130, 1, 30, 0.5, TerrainType.WIESE) },
{ TerrainType.OZEAN, (100, 1, 10, 0.4, TerrainType.WIESE) },
{ TerrainType.FORST, (100, 1, 10, 0.4, TerrainType.WIESE) },
{ TerrainType.DSCHUNGEL, (50, 1, 20, 0.4, TerrainType.WIESE) },
{ TerrainType.FLUSS, (50, 1, 5, 0.1, TerrainType.OZEAN) }
});
specialResourceMap = ResourceGenerator.GenerateResources(typemap);
......@@ -99,7 +99,7 @@ namespace Civ2.MapGeneration.UnityMap
// check if soldier would walk on ocean or out of map
Vector2Int movement = Map<bool>.GetMovement(direction);
Vector2Int targetPosition = soldierScript.positionInTilemap + movement;
if (typemap.IsInMap(targetPosition) && !typemap.Get(targetPosition).Equals(TypeName.OZEAN))
if (typemap.IsInMap(targetPosition) && !typemap.Get(targetPosition).Equals(TerrainType.OZEAN))
{
moved = true;
// move soldier
......@@ -128,7 +128,7 @@ namespace Civ2.MapGeneration.UnityMap
public void ExploreWholeMap()
{
foreach (Pair<TypeName, Vector2Int> entry in typemap)
foreach (Pair<TerrainType, Vector2Int> entry in typemap)
{
Explore(entry.GetSecond());
}
......@@ -139,20 +139,20 @@ namespace Civ2.MapGeneration.UnityMap
/// </summary>
private void Explore(Vector2Int coord)
{
TypeName type = typemap.Get(coord);
ResourceName resource = specialResourceMap.Get(coord);
TerrainType type = typemap.Get(coord);
Resource resource = specialResourceMap.Get(coord);
// determine types of adjacent tiles
Dictionary<Position, TypeName> typesAdjacentTiles = new Dictionary<Position, TypeName>(8);
Dictionary<Position, TerrainType> typesAdjacentTiles = new Dictionary<Position, TerrainType>(8);
foreach (Position position in Enum.GetValues(typeof(Position)))
{
TypeName adjacentType;
TerrainType adjacentType;
try
{
adjacentType = typemap.Get(typemap.GetCoord(coord, position));
}
catch (ArgumentException)
{
adjacentType = TypeName.NONE;
adjacentType = TerrainType.NONE;
}
typesAdjacentTiles[position] = adjacentType;
}
......@@ -161,7 +161,7 @@ namespace Civ2.MapGeneration.UnityMap
Tile baseFillerTile = Util.GetRandomElement(typeTiles[type]);
baseFillers.SetTile((Vector3Int)coord, baseFillerTile);
if (!type.Equals(TypeName.OZEAN))
if (!type.Equals(TerrainType.OZEAN))
{
// set overlying tiles / connection tiles
SetOverlyingTile(coord, type, typesAdjacentTiles);
......@@ -177,7 +177,7 @@ namespace Civ2.MapGeneration.UnityMap
// set resource tile
if (!resource.Equals(ResourceName.NONE))
if (!resource.Equals(Resource.NONE))
{
Tile resourceTile = resourceTiles[resource];
resources.SetTile((Vector3Int)coord, resourceTile);
......@@ -185,38 +185,38 @@ namespace Civ2.MapGeneration.UnityMap
}
/// <summary>
/// Set tiles overlying the base tiles for TypeName.BERGE, TypeName.HUEGEL, TypeName.FORST and TypeName.FLUSS
/// Set tiles overlying the base tiles for TerrainType.BERGE, TerrainType.HUEGEL, TerrainType.FORST and TerrainType.FLUSS
/// </summary>
private void SetOverlyingTile(Vector2Int coord, TypeName type, Dictionary<Position, TypeName> typesAdjacentTiles)
private void SetOverlyingTile(Vector2Int coord, TerrainType type, Dictionary<Position, TerrainType> typesAdjacentTiles)
{
TypeName[] typesToConnect;
// TypeName.FLUSS tiles need connection to TypeName.FLUSS and TypeName.OZEAN,
TerrainType[] typesToConnect;
// TerrainType.FLUSS tiles need connection to TerrainType.FLUSS and TerrainType.OZEAN,
// tiles of other types only need connections to tiles of the same type
if (type.Equals(TypeName.FLUSS))
if (type.Equals(TerrainType.FLUSS))
{
typesToConnect = new TypeName[] { TypeName.OZEAN, TypeName.FLUSS };
typesToConnect = new TerrainType[] { TerrainType.OZEAN, TerrainType.FLUSS };
}
else
{
typesToConnect = new TypeName[] { type };
typesToConnect = new TerrainType[] { type };
}
SetConnectionTile(coord, type, typesToConnect, typesAdjacentTiles);
}
/// <summary>
/// Set the river mouth for tile of type TypeName.OZEAN.
/// Set the river mouth for tile of type TerrainType.OZEAN.
/// </summary>
private void SetRiverMouthTile(Vector2Int coord, Dictionary<Position, TypeName> typesAdjacentTiles)
private void SetRiverMouthTile(Vector2Int coord, Dictionary<Position, TerrainType> typesAdjacentTiles)
{
// connect TypeName.FLUSS to TypeName.OZEAN
SetConnectionTile(coord, TypeName.OZEAN, new TypeName[] { TypeName.FLUSS }, typesAdjacentTiles);
// connect TerrainType.FLUSS to TerrainType.OZEAN
SetConnectionTile(coord, TerrainType.OZEAN, new TerrainType[] { TerrainType.FLUSS }, typesAdjacentTiles);
}
/// <summary>
/// Set the tile at the specified coordinate for the specified type that has "connections" to adjacent tiles (for TypeName.BERGE, TypeName.HUEGEL and TypeName.FORST to adjacent tiles
/// of the same type, for TypeName.FLUSS additionally to TypeName.OZEAN)
/// Set the tile at the specified coordinate for the specified type that has "connections" to adjacent tiles (for TerrainType.BERGE, TerrainType.HUEGEL and TerrainType.FORST to adjacent tiles
/// of the same type, for TerrainType.FLUSS additionally to TerrainType.OZEAN)
/// </summary>
private void SetConnectionTile(Vector2Int coord,