com.brackeen.javagamebook.scripting
Class GameTask

java.lang.Object
  extended bycom.brackeen.javagamebook.scripting.GameTask
All Implemented Interfaces:
java.lang.Runnable

public class GameTask
extends java.lang.Object
implements java.lang.Runnable

A game task that can be scheduled for one-time execution.


Constructor Summary
GameTask(long delay, java.lang.Runnable runnable)
          Creates a new GameTask that will execute the specified Runnable after a delay.
 
Method Summary
 void cancel()
          Cancels this task.
 boolean check(long elapsedTime)
          Checks to see if this GameTask is ready to execute, and if so, it is executed.
 void run()
          Runs this task.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameTask

public GameTask(long delay,
                java.lang.Runnable runnable)
Creates a new GameTask that will execute the specified Runnable after a delay.

Method Detail

cancel

public void cancel()
Cancels this task.


run

public void run()
Runs this task.

Specified by:
run in interface java.lang.Runnable

check

public boolean check(long elapsedTime)
Checks to see if this GameTask is ready to execute, and if so, it is executed. Returns true if the task is done (either it executed or previously canceled).