Vielen Dank im Voraus für jede Hilfe, die Sie geben können.
Code: Select all
public int width = 10;
public int height = 10;
public GameObject[] tilePrefabs;
void Start()
{
GenerateLevel();
}
void GenerateLevel()
{
for (int x = -10; x < width; x++)
{
for (int y = -4; y < height; y++)
{
for (int i = 0; i < tilePrefabs.Length; i++)
{
if (Random.value > 0.5f) // 50% chance to place a tile
{
int randomIndex = Random.Range(0, tilePrefabs.Length);
Vector2 position = new Vector2(x, y);
Instantiate(tilePrefabs[randomIndex], position, Quaternion.identity);
}
}
}
}
}
void FixedUpdate()
{
if ((GameControl.control.matches >= 69) && (GameControl.control.matches < 207))
{
SceneManager.LoadScene("Level2");
}
}