Scriptum/Assets/Scripts/ProceduralGeneration/Map.cs

42 lines
1005 B
C#
Raw Permalink Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace GUI_Scripts.ProceduralGeneration
{
public class Map
{
public Dictionary<Vector2Int, int > tiles;
public Vector2Int size;
public Map(Vector2Int size)
{
tiles = new Dictionary<Vector2Int, int>();
for (int x = 0; x < size.x; x++)
{
for (int y = 0; y < size.y; y++)
{
tiles.Add(new Vector2Int(x,y),0);
}
}
this.size = size;
}
public void Fill(List<FloodFill> fillers)
{
int count = fillers.Count;
while (count > 0)
{
count = fillers.Count;
foreach (var filler in fillers)
{
if (filler.Fill())
{
count--;
}
}
}
}
}
}