// CLASS FUNCTIONS public void addNote(int number, string name, int index, float time) { while (time >= staffs[staffs.Length - 1].startTime + StaffPair.staffLength) { StaffPair sp = Instantiate(staffPairPrefab, transform).GetComponent <StaffPair>(); sp.startTime = staffs[staffs.Length - 2].startTime + StaffPair.staffLength; } int toAddIndex = 0; while (time >= staffs[toAddIndex].startTime + StaffPair.staffLength) { toAddIndex++; } staffs[toAddIndex].addNote(number, name, index, time); }
// UNITY FUNCTIONS private void Start() { StaffPair sp = Instantiate(staffPairPrefab, transform).GetComponent <StaffPair>(); sp.startTime = 0; }