Charakter Erstellt, Erste ordner für die Ordnung und Map Generator script

This commit is contained in:
2026-06-11 12:42:08 +02:00
parent 9cf885273a
commit c89d88be8c
11 changed files with 2510 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
using UnityEngine;
public class Map_Generator : MonoBehaviour
{
public Texture2D tex;
public int width;
public int heigt;
public Color[] pixelFarbe;
public GameObject blockPrefab;
void Start()
{
width = tex.width;
heigt = tex.height;
pixelFarbe = new Color[width * heigt];
for (int i = 0; i < heigt; i++)
{
for (int k = 0; k < width; k++)
{
pixelFarbe[k + i * width] = tex.GetPixel(k, i);
//pixelFarbe[k + i * width] = Random.ColorHSV();
}
}
for (int i = 0; i < heigt; i++)
{
for (int k = 0; k < width; k++)
{
if (pixelFarbe[k + i * width].grayscale >= Color.gray.grayscale)
{
GameObject block = Instantiate(blockPrefab);
block.transform.position = new Vector3(k, 0, i);
block.GetComponent<Renderer>().material.color = Random.ColorHSV();
}
}
}
}
void Update()
{
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 079eca2fab980b94ea6d88afb4570141