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.
RatAttack2D/Assets/Scripts/rectangleroomgen.cs

35 lines
931 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class rectangleroomgen : MonoBehaviour
{
public RuleTile Rule;
public Tilemap map;
public TileBase empty;
public GameObject player;
public GameObject Camera;
void Start()
{
System.Random ran = new System.Random();
Vector2Int size = new Vector2Int(ran.Next(25, 50), ran.Next(10, 25));
for (int x = 0; x < size.x+22; x++)
{
for (int y = 0; y < size.y+22; y++)
{
map.SetTile(new Vector3Int(x, y, 0), Rule);
}
}
for (int x = 11; x < size.x+11; x++)
{
for (int y = 11; y < size.y+11; y++)
{
map.SetTile(new Vector3Int(x, y, 0), empty);
}
}
player.transform.position = new Vector3((size.x)*8, (size.y)*8, 0);
}
}