You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
853 B
38 lines
853 B
2 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.Tilemaps;
|
||
|
|
||
|
public class WFCGenerator : MonoBehaviour
|
||
|
{
|
||
|
public Tiles[] tiles;
|
||
|
public TileBase Rules;
|
||
|
public Vector2Int maxsize;
|
||
|
public Tilemap ForeGround;
|
||
|
public Tilemap BackGround;
|
||
|
// Start is called before the first frame update
|
||
|
void Start()
|
||
|
{
|
||
|
for(int i = 0; i < maxsize.x; i++)
|
||
|
{
|
||
|
for(int k = 0; k < maxsize.y; k++)
|
||
|
{
|
||
|
ForeGround.SetTile(new Vector3Int(i, k, 0), Rules);
|
||
|
}
|
||
|
}
|
||
|
ForeGround.SetTile(new Vector3Int(5, 5, 0), tiles[0].tile);
|
||
|
}
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
[System.Serializable]
|
||
|
public struct Tiles
|
||
|
{
|
||
|
public TileBase tile;
|
||
|
public int index;
|
||
|
}
|
||
|
}
|