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()); }
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); }
// 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; }
public void Add(SpawnInstruction i) { instructions.Add(i); }