Forum C# Timers

Timers

Postby Sam_O » July 5th, 2010, 8:12 pm

Seeing as how System.Timers are not allowed, how do I implement the PlayerIO Timer into a new custom class? Thanks ahead of time :)
Sam_O
 
Posts: 22
Joined: June 2nd, 2010, 3:25 am

Re: Timers

Postby Oliver » July 6th, 2010, 11:52 am

The game class has AddTimer and ScheduleCallback methods for this exact purpose.

http://playerio.com/documentation/refer ... e#AddTimer

http://playerio.com/documentation/refer ... leCallback

I'm pretty sure there is some example code in the NewGame example of the download file.

Best,
Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Timers

Postby Sam_O » July 6th, 2010, 4:55 pm

I guess I didn't ask correctly sorry about that, what I'm trying to do is have a new custom class, lets call it "debuff", have a timer inside of it, how would I do that without referencing the game class directly (ex. gameClassRef.AddTimer(....);) is there a way to implement the AddTimer into a new class?
Sam_O
 
Posts: 22
Joined: June 2nd, 2010, 3:25 am

Re: Timers

Postby Oliver » July 6th, 2010, 5:11 pm

Hey Sam,

You'll have to pass around a reference to the game instance, it's the only way to do it :)

- Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Timers

Postby Sam_O » July 6th, 2010, 5:14 pm

I see, yea that is the way I ended up doing it just wondering if there was another way, but anyways thanks Oliver for the replies.
Sam_O
 
Posts: 22
Joined: June 2nd, 2010, 3:25 am


Return to C#



cron