예제 #1
0
    private void GenerateNextNote(BeatEntry beatInfo)
    {
        var instance = Instantiate(NotePrefab);

        instance.Init(beatInfo.ExpectedNote, beatInfo.Beat, container, startNote.position, endNote.position);
        notesSpawned.Add(instance);
    }
예제 #2
0
파일: Song.cs 프로젝트: wildrabbit/ld41
    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);
    }
예제 #3
0
파일: Song.cs 프로젝트: wildrabbit/ld47
    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);
    }
예제 #4
0
파일: Song.cs 프로젝트: wildrabbit/ld41
 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);
     }
 }
예제 #5
0
파일: Song.cs 프로젝트: wildrabbit/ld47
 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));
 }