Modelowanie_Wirtualnych_Swi.../Assets/voxelNames.cs
2021-05-23 21:13:09 +02:00

46 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class voxelNames : MonoBehaviour
{
public GameObject wsp;
int frame = 0;
// Start is called before the first frame update
void Start()
{
frame = 0;
}
// Update is called once per frame
void Update()
{
int i = 0;
int y = 0;
if(frame > 120 && frame < 460)
{
foreach(Transform level in gameObject.transform)
{
int xz = 0;
foreach(Transform cube in level.transform)
{
if(i == (frame-120)*5)
{
int x = xz%4;
int z = (int)(xz/4);
int randName = (int)UnityEngine.Random.Range(0,10);
GameObject opis = Instantiate(wsp);
opis.transform.parent = cube;
opis.transform.localPosition = new Vector3(0,0,0);
opis.GetComponent<TextMesh>().text = "("+x+","+y+","+z+")\n"+randName;
}
xz++;
i++;
}
y++;
}
}
frame++;
}
}