public LoopObject DouplicateLoopObject(LoopObject loopObject, List <LoopObject> addToList) { // 1. Change existing object loopObject.hasRespawned = true; // 2. Refs var obj = MeshRef.inst.loopObject; var parent = MeshRef.inst.recordObj_parent; var position = Recorder.inst.NextLoopPosition(Recorder.inst.sequencers[0], loopObject.loopStart); // 3. Instantiate var newObj = LoopObject.Create(obj, parent, position, loopObject.loopStart, loopObject.loopEnd_extended, addToList); return(newObj); }
// ------------------------------ Private functions ------------------------------ // Recording /// <summary> /// Save data of currently one recording chord to the RECORDING-variable (start time, notes, fieldID, sequencer, quantizeOffset). /// </summary> private void SaveRecordStartData() { float sequencerPos = (float) CurSequencer.GetSequencerPosition(); // 1. Start & quantize offset if (MusicManager.inst.quantize) { float quantize = Quantize(sequencerPos); recording.start = quantize; // hack für sequencerPos bei sequencer.length: quantize 0 oder 32 (sequencer.length) if (quantize == 0 && sequencerPos > CurSequencer.length / 2) { quantize = CurSequencer.length; } recording.startQuantizeOffset = quantize - sequencerPos; } else { recording.start = sequencerPos; recording.startQuantizeOffset = 0; } // 2. End, notes, ID, sequencer recording.notes = MusicManager.inst.curChord.DeepCopy().notes; recording.fieldID = Player.inst.curField.ID; recording.sequencer = CurSequencer; recording.isRunning = true; // 3. LoopStart object? if (!Has1stRecord) { loopStart = recording.start; loopEnd_extended = loopStart + CurSequencer.length; var obj = MeshRef.inst.loopObject; var parent = MeshRef.inst.recordObj_parent; var position = Player.inst.transform.position; LoopObject.Create(obj, parent, position, loopStart, loopEnd_extended, loopObjects); } }