Esempio n. 1
0
        public static NoteBar CreateNoteBar(int numNotes, int numReverse, int posX, int posY)
        {
            var newNoteBar = new NoteBar();

            for (int x = 0; x < numNotes; x++)
            {
                var direction = (NoteDirection)_rnd.Next((int)NoteDirection.COUNT);
                newNoteBar.Notes.Add(new Note {
                    Completed = false, Direction = direction, Reverse = false
                });
            }
            for (int x = 0; x < Math.Min(numReverse, numNotes); x++)
            {
                int idx = _rnd.Next(newNoteBar.Notes.Count);
                while (newNoteBar.Notes[idx].Reverse)
                {
                    idx = _rnd.Next(newNoteBar.Notes.Count);
                }
                newNoteBar.Notes[idx].Reverse = true;
            }
            newNoteBar.X = posX;
            newNoteBar.Y = posY;

            CheckForTriples(newNoteBar);
            return(newNoteBar);
        }
Esempio n. 2
0
 private static void CheckForTriples(NoteBar newNoteBar)
 {
     if (newNoteBar.Notes.Count < 3)
     {
         return;
     }
     for (int x = 0; x <= newNoteBar.Notes.Count - 3; x++)
     {
         if ((newNoteBar.Notes[x].Direction == newNoteBar.Notes[x + 1].Direction) && (newNoteBar.Notes[x].Direction == newNoteBar.Notes[x + 2].Direction))
         {
             var temp = (int)newNoteBar.Notes[x + 1].Direction;
             var adj  = _rnd.Next(1, 4);
             newNoteBar.Notes[x + 1].Direction = (NoteDirection)((temp + adj) % (int)NoteDirection.COUNT);
         }
     }
 }
Esempio n. 3
0
        public NoteBar Clone()
        {
            var result = new NoteBar();

            result.RednessSprite = new Sprite3D
            {
                Position     = RednessSprite.Position,
                Size         = RednessSprite.Size,
                Texture      = RednessSprite.Texture,
                ColorShading = RednessSprite.ColorShading
            };
            foreach (Note n in Notes)
            {
                result.Notes.Add(new Note {
                    Completed = n.Completed, Direction = n.Direction, Reverse = n.Reverse
                });
            }
            return(result);
        }