Search Unity

Koreographer - Audio Driven Events, Animation, and Gameplay

Discussion in 'Assets and Asset Store' started by SonicBloomEric, Sep 15, 2015.

  1. SonicBloomEric

    SonicBloomEric

    Joined:
    Sep 11, 2014
    Posts:
    619
    You will need to make a fair bit of adjustments to the demo code, but it shouldn't be crazy. The core logic is all there - you'll just need to abstract what's there into something a bit more generic so that you can trigger the content as a "playlist".

    That's not precisely true, though. The demo code already performs look-ahead for the lead-in time. That is the system that allows you to see the notes falling before the music begins. Take a look at how the leadInTime, leadInTimeLeft, and timeLeftToPlay members are used in the RhythmGameController class.

    You should be able to abstract all of that code out into something like a "RhythmGameTrack" class that the RhythmGameController then uses as part of a list (a "playlist", if you will). Each RhythmGameTrack would then handle its own lead-in-time. The RhythmGameController class would then need to be updated to check whether the "next" RhythmGameTrack should begin or not.

    You will, of course, need to figure out how to get the looping to be "spot on". To do this, you will need to calculate how much time it takes for the gems to travel from the top of the screen to the bottom. That would then be your "next track's lead-in-time".

    I hope this is helpful!
     
    Guacamolay likes this.
  2. Guacamolay

    Guacamolay

    Joined:
    Jun 24, 2013
    Posts:
    42
    Thanks for the help, I'll look into it :D
     
    SonicBloomEric likes this.
  3. sebastiansgames

    sebastiansgames

    Joined:
    Mar 25, 2014
    Posts:
    114
    Hey there! Got a question for you. Koreographer is working great for my project but I'm interested in having a song loop with some overlap (ie music starts playing again before it completely ends).

    Currently using the Simple Music Player. For overlapped looping initial instinct was to duplicate the Simple Music Player so I'd have an A and a B iteration. Put a Koreography event near the end of the track which fires and starts B playing, then vice versa. While the audio sounds fine, I can't figure out how to stop listening to Koreography events from A when I switch to B etc. So I'm getting doubling up of Koreographer events which is leading to all sorts of problems. Is there a solution you might suggest? Thank you!
     
  4. SonicBloomEric

    SonicBloomEric

    Joined:
    Sep 11, 2014
    Posts:
    619
    There are several ways that you might handle this but the absolute simplest approach would probably be to disable the SimpleMusicPlayer component for A when you start B. Similarly, you would reverse that whenever the looping occurs (e.g. B→A would be "disable B, enable A").

    The SimpleMusicPlayer drives updates through its internal visor through the MonoBehaviour Update() function. Disabling the component should stop Update from being called which, in turn, should stop the "event pump" from that component.

    Please give that a shot and let us know how it goes!
     
    sebastiansgames likes this.
  5. sebastiansgames

    sebastiansgames

    Joined:
    Mar 25, 2014
    Posts:
    114
    Wow that worked like a charm! I somehow imagined that disabling the SimpleMusicPlayer would also stop the playback -- but the playback continued and the events stopped firing as you suggested. Thank you!!! Really loving Koreographer. Thanks again!
     
    SonicBloomEric likes this.