In my app, I have a music generator running separate from the graphics (not directly tied to any graphic events or nodes), and this is all done in objects that are isolated from the main CCScene. However, I still want to use cocos2d timers, because I want the music generation to pause when the game pauses, and pick up again when resumed.
So, it seemed perfect to create CCTimers and schedule them with [CCScheduler sharedScheduler]. But, I also need to be able to pass an object with the timer, similar to NSTimer's userInfo parameter (e.g., the music generator object has to pass which sounds are to be played to the object that actually is responsible for playing them). Setting up a queue won't work, because the intervals may vary, and therefore timers trigger out of order from the way they were scheduled.
I first tried subclassing CCTimer and adding a userInfo property. I thought this would work great, but (unlike NSTimer) the CCTimer instance is not passed to the selector as a parameter...so there's no way to access the userInfo property. It appears that no parameters are passed to the target/selector when it is called. Is that correct?
I suppose I *might* could somehow use CCCallFuncND, but as I said, there are no CCNodes involved in this part of my code, so I'd have to parasitically use some global node object, which gets very messy. I'd probably rather not go there.
Is there a way to do what I'm describing that I haven't seen?
Thanks in advance!