Пример #1
0
    // Use this for initialization
    void Start()
    {
        audio_source = GetComponent <AudioSource>();
        song         = BeatFile.ReadStepfile("Assets/Resources/music/" + path + "/" + simfileName);
        string audio_path = "music/" + path + "/" + System.IO.Path.GetFileNameWithoutExtension(song.metadata["MUSIC"]);

        Debug.Log(audio_path);
        audio_source.clip = Resources.Load <AudioClip>(audio_path);

        /*try
         * {
         *  string bg_path = "music/" + path + "/" + System.IO.Path.GetFileNameWithoutExtension(song.metadata["BACKGROUND"]);
         *  Debug.Log(bg_path);
         *  bg_render.material.mainTexture = Resources.Load<Texture>(bg_path);
         * }
         * catch { }*/

        beatLerper     = new BeatLerper(song.bpmEvents, song.offset);
        notes_iter     = song.notes.OrderBy(note => note.beat);
        beatMultiplier = System.Math.Pow(2, beatMultiplierLog);
        //onBeat += SpawnNotes;
        //onBeat += AnimateLines;
        ready = true;

        foreach (NoteController board in boards)
        {
            board.Initialize(this, notes_iter);
        }

        Debug.Log("Ready.");
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        audio_source = GetComponent <AudioSource>();

        /*
         * System.IO.File.WriteAllLines("beats.txt",
         *  Enumerable.Range(1, 300 * 32)
         *      .Select(t => beatLerper.TimeFromBeat((float)t / 32).ToString())
         *      .ToArray());
         */
        Song song = BeatFile.ReadStepfile("Assets/music/Baby Bowser's Lullaby.sm");

        //beatLerper = new BeatLerper(song.bpmEvents, song.offset);
        //notes_iter = song.notes.OrderBy(note => note.beat);
        onBeat += SpawnNotes;
    }