|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectserver.framework.threads.GameThread
public class GameThread
This thread is responsible for bundling player positions into one big position message, instead of transmitting many small position messages.
Field Summary | |
---|---|
static int |
POSITION_INTERVAL
|
Constructor Summary | |
---|---|
GameThread(AbstractSession session)
Initiates the GameThread 's lists and assigns the thread's session. |
Method Summary | |
---|---|
void |
addPosition(AbstractPlayer sender,
java.lang.Object[] position)
Adds a position to the position list. |
void |
freezePlayer(AbstractPlayer player,
int duration)
"Freezes" a player to a position for a given duration. |
static void |
main(java.lang.String[] args)
Test method used to test the performance of the bundle generation method. |
void |
run()
The loop that is responsible for creating and sending position bundles with regular intervals. |
void |
stop()
Called when the game is over. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int POSITION_INTERVAL
Constructor Detail |
---|
public GameThread(AbstractSession session)
GameThread
's lists and assigns the thread's session.
session
- The session owning the game thread.Method Detail |
---|
public void run()
POSITION_INTERVAL
variable.
run
in interface java.lang.Runnable
public void stop()
public void addPosition(AbstractPlayer sender, java.lang.Object[] position)
sender
- The player.position
- The position.public void freezePlayer(AbstractPlayer player, int duration)
player
- The player to freeze in place.duration
- The duration of the freeze.public static void main(java.lang.String[] args)
args
- Empty.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |