private void GenerateNextNote(BeatEntry beatInfo) { var instance = Instantiate(NotePrefab); instance.Init(beatInfo.ExpectedNote, beatInfo.Beat, container, startNote.position, endNote.position); notesSpawned.Add(instance); }
public bool GetBeat(int idx, out BeatEntry entry) { bool valid = idx >= 0 && idx < beats.Count; if (valid) { entry = beats[idx]; } else { entry = new BeatEntry(-1, 0, BeatType.Default); } return(valid); }
public bool TryGetBeat(int idx, out BeatEntry entry) { bool valid = idx >= 0 && idx < beats.Count; if (valid) { entry = beats[idx]; } else { entry = BeatEntry.NoBeat; } return(valid); }
public void LoadSheet() { string[] lines = Regex.Split(songSheet.text, "\n|\r|\r\n"); foreach (string l in lines) { string[] tokens = l.Split(' '); if (tokens.Length != 3) { continue; } BeatEntry b = new BeatEntry(); System.Int32.TryParse(tokens[0], out b.beat); System.Int32.TryParse(tokens[1], out b.duration); int type; System.Int32.TryParse(tokens[2], out type); b.type = (BeatType)type; beats.Add(b); } }
public void LoadSheet() { string[] lines = Regex.Split(songSheet.text, "\n|\r|\r\n"); foreach (string l in lines) { string[] tokens = l.Split(' '); if (tokens.Length != 3) { continue; } BeatEntry b = new BeatEntry(); CultureInfo sysCulture = CultureInfo.CurrentCulture; CultureInfo angloCulture = CultureInfo.GetCultureInfo("en-US"); float.TryParse(tokens[0], NumberStyles.Any, CultureInfo.InvariantCulture, out b.Beat); float.TryParse(tokens[1], NumberStyles.Any, CultureInfo.InvariantCulture, out b.BeatDuration); int type; System.Int32.TryParse(tokens[2], out type); b.ExpectedNote = (NoteType)type; beats.Add(b); } beats.Sort((b1, b2) => b1.Beat.CompareTo(b2.Beat)); }