public Texture2D Color_Map() { Color[] colorMap = new Color[resolution * resolution]; float color_perlin_offset = Random.value; { for (int w = 0; w < resolution; w++) { for (int h = 0; h < resolution; h++) { if ( ((w - resolution / 2) * (w - resolution / 2) + (h - resolution / 2) * (h - resolution / 2)) > //speed* (Time.time-start_Time) 122 * 122 ) { if (((w - resolution / 2) * (w - resolution / 2) + (h - resolution / 2) * (h - resolution / 2)) < //speed * (Time.time - start_Time)+ thickness 122 * 122 + thickness ) { float perlineNoise = Mathf.PerlinNoise(w * perlin_scale, h * perlin_scale); if (perlineNoise <= completness) { colorMap[w * resolution + h] = GoldenColor.GenerateColor(35f, 95f, 1f); //colorMap[w * resolution + h] = new Color(1, 1, 1); continue; } } } colorMap[w * resolution + h] = new Color(0, 0, 0); } } } Texture2D texture = TextureFromColorMap(colorMap); return(texture); }
void Start() { rb = GetComponent <Rigidbody>(); rb.centerOfMass = centermass; if (random_letter) { Random.InitState((int)System.DateTime.Now.Ticks); text.Text = Alphabet[(int)(Random.value * 26f - 0.1f)]; text.GenerateText(); letter = text.transform.GetChild(1); //letter.localScale = letter.localScale * transform.localScale.x; transform.localScale = transform.localScale * scale; // rb.centerOfMass = centermass * scale; letter_collider = letter.gameObject.AddComponent(typeof(MeshCollider)) as MeshCollider; letter_rigidbody = letter.gameObject.AddComponent(typeof(Rigidbody)) as Rigidbody; letter_collider.convex = true; transform.GetComponent <FixedJoint>().connectedBody = letter_rigidbody; letter.GetComponent <Renderer>().material.color = //new Color(0.5f, 1, 1); GoldenColor.GenerateColor(0.6f, 0.95f, 0f); } else { Random.InitState((int)System.DateTime.Now.Ticks); letter = text.transform.GetChild(1); letter_collider = letter.gameObject.AddComponent(typeof(MeshCollider)) as MeshCollider; letter_rigidbody = letter.gameObject.AddComponent(typeof(Rigidbody)) as Rigidbody; letter_collider.convex = true; transform.GetComponent <FixedJoint>().connectedBody = letter_rigidbody; } }