Exemple #1
0
        private Note[] SpawnNotes(SpawnInstruction instruction, Color color)
        {
            List <Note> notes = new List <Note>();

            if (instruction.up)
            {
                notes.Add(CreateNote(Vector2.up * noteOffset, instruction.targetBeat, Direction.UP, color));
            }

            if (instruction.down)
            {
                notes.Add(CreateNote(Vector2.down * noteOffset, instruction.targetBeat, Direction.DOWN, color));
            }

            if (instruction.left)
            {
                notes.Add(CreateNote(Vector2.left * noteOffset, instruction.targetBeat, Direction.LEFT, color));
            }

            if (instruction.right)
            {
                notes.Add(CreateNote(Vector2.right * noteOffset, instruction.targetBeat, Direction.RIGHT, color));
            }

            return(notes.ToArray());
        }
Exemple #2
0
        private SpawnInstruction RandomSpawnInstruction(float[] chances, float beat)
        {
            if (chances.Length != 4)
            {
                throw new ArgumentException("spawn instruction chances must be an array of length 4");
            }

            chances.Shuffle();
            SpawnInstruction instruction = new SpawnInstruction();

            if (chances[0] > RNG.rng.NextDouble())
            {
                instruction.up = true;
            }
            if (chances[1] > RNG.rng.NextDouble())
            {
                instruction.down = true;
            }
            if (chances[2] > RNG.rng.NextDouble())
            {
                instruction.left = true;
            }
            if (chances[3] > RNG.rng.NextDouble())
            {
                instruction.right = true;
            }

            instruction.targetBeat = beat;

            return(instruction);
        }
Exemple #3
0
        // add a spawn instruction to the beatmap
        public void RecordToBeatmap(float currentBeat, bool up, bool down, bool left, bool right)
        {
            if (currentBeat < 0)
            {
                return;
            }
            if (!up && !down && !left && !right)
            {
                return;
            }

            SpawnInstruction currentInstruction = new SpawnInstruction();

            currentInstruction.up    = up;
            currentInstruction.down  = down;
            currentInstruction.left  = left;
            currentInstruction.right = right;

            currentInstruction.targetBeat = currentBeat;

            if (up)
            {
                noteCounter++;
            }
            if (down)
            {
                noteCounter++;
            }
            if (left)
            {
                noteCounter++;
            }
            if (right)
            {
                noteCounter++;
            }

            currentBuffer.instructions.Add(currentInstruction);
            currentBuffer.notes = noteCounter;
        }
Exemple #4
0
 public void Add(SpawnInstruction i)
 {
     instructions.Add(i);
 }