void Start() { SetTimerActive(false); lastStepTime = 0f; roomMesh = (!roomMesh || useManualMesh) ? CubeMeshGenerator.GenerateMesh(roomScale) : roomMesh; ResetGeneration(ref rooms, floorSize); }
public void Awake() { GetComponent <MeshRenderer>().sharedMaterial = material; filter = GetComponent <MeshFilter>(); mesh = new Mesh(); filter.sharedMesh = mesh; g = new CubeMeshGenerator(this); Generate(); }
// Start is called before the first frame update void Start() { for (int x = 0; x < width; x++) { for (int z = 0; z < depth; z++) { Vector3 pos = new Vector3(x, Mathf.PerlinNoise(x * 0.21f, z * 0.21f) * noiseFactor, z); if (usePrefab) { GameObject cube = Instantiate(cubePrefab, pos, Quaternion.identity); } else { CubeMeshGenerator.CreateCube(x * depth + z, pos); } } } }
void Awake() { physicsCollider = GetComponent <SphereCollider>(); body = GetComponent <Rigidbody>(); meshes = new Mesh[] { new Mesh(), new Mesh(), new Mesh() }; colliderRadiuses = new float[] { 0f, 0f, 0f }; meshesInitialized = new bool[] { false, false, false }; filter = GetComponent <MeshFilter>(); filter.sharedMesh = meshes[0]; meshGenerator = new CubeMeshGenerator(this); // initial rotation body.AddTorque(0, 0, rotationSpeed, ForceMode.VelocityChange); }