// Start is called before the first frame update void Start() { int i = 0; for (int c = 0; c < 16; c++) //channel { for (int v = 0; v < 8; v++) //note = velocity { // Golden Ratio / phyllotaxis math float angle = (i * 137.6f) * Mathf.Rad2Deg; // 137.3 // 137.6 <-- play with angles to test out different visual patterns float radius = scaleOfRadius * Mathf.Sqrt(i); float x = radius * Mathf.Cos(angle); float y = radius * Mathf.Sin(angle); float z = radius * pointiness; // creating all the cubes with Instantiate GameObject shape = Instantiate(cube, new Vector3(x, y, z), Quaternion.identity); // default pos 0,0,0 shape.name = "shape"; shape.transform.parent = GameObject.Find("Generator").transform; // setting the parent of all cubes to be the GameObject // this script is attached to shape.transform.LookAt(Vector3.zero, Vector3.forward); // make all cubes direct themselves at (0,0,0) shape.SetActive(true); // make cubes visible // connect shape to Orca NoteIndicator noteIndicator = shape.AddComponent <NoteIndicator>(); noteIndicator.noteNumber = i; // give each cube a noteNumber (MIDI note number) noteIndicator.channel = c; // refers to first loop noteIndicator.velocity = v; // refers to second loop i++; } } }
/// <summary> /// Constructor para instanciar un nuevo ícono de nota, asignando sus respectivas variables. /// </summary> /// <param name="group">La nota de referencia.</param> /// <param name="index">El índice de la nota en el array de SongManagerNoteInput.</param> /// <param name="owner">La UI dueña.</param> public GroupIconInstances(NoteGroup group, NotesUI owner, Action <GroupIconInstances> onRemove, bool nextGroup = false) { this.group = group; this.owner = owner; this.longNote = group.IsLongNote; this.durationScale = group.GetDuration * Subdivision.subtepSize / owner.beatRange; // Tomar el indicador de notas respectivo y asignarle el mismo color al ícono de nota noteIcons = new NoteIcon[SongManagerNoteInput.GetMaxInputs]; for (int i = 0; i < noteIcons.Length; i++) { if (group.GetNote(i)) { NoteIndicator indicator = owner.noteIndicators[i]; noteIcons[i] = Instantiate(owner.noteIconPrefab, indicator.GetTransform); noteIcons[i].Initialize(indicator, durationScale, i, DestroyIcon); if (nextGroup) { noteIcons[i].OnNextNote(); } noteCount++; } } group.onNoteEvent += OnIconEvent; Remove = () => onRemove(this); }