void DrumFormation(float radius) { int rnd; bool[] usedRnd = new bool[8]; for (int i = 0; i < 8; i++) { while (true) { rnd = Random.Range(0, 8); if (usedRnd[rnd] == false) { usedRnd[rnd] = true; break; } } Animator star = StarPrefabs[i]; star.gameObject.SetActive(false); DIP dip = DrumImagePrefabs[i]; dip.DrumImage = dip.GetComponent <Image>(); dip.DrumImage.sprite = PuzzleComponents[rnd].DrumImageSprite; dip.PuzzleComponents = PuzzleComponents[rnd]; dip.StarAnimator = star; float angle = -i * (2f * Mathf.PI / 8f); float x = Mathf.Cos(angle) * radius; float y = Mathf.Sin(angle) * radius; dip.transform.localPosition = new Vector3(x, y, 0); x = Mathf.Cos(angle) * radius / 2.15f; y = Mathf.Sin(angle) * radius / 2.15f; star.transform.localPosition = new Vector3(x, y, 0); } }