-
Notifications
You must be signed in to change notification settings - Fork 24
Using an ActionScheduler
Elliot Ford edited this page Jun 28, 2015
·
4 revisions
What is an ActionScheduler?
An ActionScheduler is a way to schedule Actions using an ActionEngine for a specific actor. Within the JALSE system Entity is an ActionScheduler.
JALSE offers a default implementation, DefaultActionScheduler, that takes in an actor and is backed by the default ActionEngine (see Picking an ActionEngine implementation).
ActionScheduler<String> scheduler = new DefaultActionScheduler<>("Ellzord");
Scheduling Actions for an actor
Scheduling Actions using an SchedulableActionContext provides the same execution control that is reflected in ActionScheduler's schedule(...)
methods. Every one of these methods will schedule the action with the actor bound.
// Immediately schedule action
scheduler.scheduleForActor(/* Some action */);
// Schedule action 100 ms in the future
scheduler.scheduleForActor(/* Some action */, 100, TimeUnit.MILLISECONDS);
// Schedule action for periodic execution every 500 ms
scheduler.scheduleForActor(/* Some action */, 0, 500, TimeUnit.MILLISECONDS);
Cancelling all Actions
All currently scheduled or execution Actions by the scheduler can be cancelled:
scheduler.cancelAllScheduledForActor();
Check out the Example projects and Code snippets!
Getting Started
- Getting the latest release
- Building from source
- Example projects
- Code snippets
- How to contribute
- Have bugs or questions?
How To Use
- JALSE
- Entities
- Attributes
- Actions
- Tags
Misc