/// <summary> /// Remove a melody from the Generator /// </summary> /// <param name="melody">The melody To remove</param> public void RemoveFromGenerator(MelodyBubble melody) { if (MelodyBubbles.Contains(melody)) { MelodyBubbles.Remove(melody); } }
/// <summary> /// Create a random MelodyBubble /// </summary> public MelodyBubble CreateMelodyBubble(List<MelodyBubble> bubbles) { WildBubbles[Gesture.infinite] = 0; WildBubbles[Gesture.s] = 0; WildBubbles[Gesture.t] = 0; WildBubbles[Gesture.wave] = 0; WildBubbles[Gesture.zigzag] = 0; foreach (MelodyBubble mb in bubbles) WildBubbles[mb.Melody.gesture]++; MelodyBubble newMelodyBubble = new MelodyBubble(MostNeeded()); MelodyBubbles.Add(newMelodyBubble); return newMelodyBubble; }
/// <summary> /// Adds a group of Notes contained in a MelodyBubble on the stave at a defined position. /// </summary> /// <param name="mb">The MelodyBubble</param> /// <param name="position">The Position</param> public void AddMelody(MelodyBubble mb, int position) { int cardMelody = mb.Melody.Notes.Count; int i; for(i = 0; i< cardMelody ; i++) { mb.Melody.Notes[i].Position += position; if (mb.Melody.Notes[i].Position >= GlobalVariables.MaxPositionOnStave) break; int posArray = 0; while ((posArray < Notes.Count) && (Notes[posArray].Position < mb.Melody.Notes[i].Position)) { posArray++; } Notes.Insert(posArray, mb.Melody.Notes[i]); } MaxPosition = Math.Max(MaxPosition, mb.Melody.Notes[i-1].Position); }