|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.starhope.appius.game.GameEvent
com.tootsville.game.VolleyballCourt
public class VolleyballCourt
| Field Summary | |
|---|---|
private Volleyball |
ball
Pointer to the user that represents the soccer ball |
private int |
lastX
Last x coordinate of the last transmission |
private int |
lastY
Last y coordinate of the last transmission |
private org.starhope.appius.geometry.Coord2D |
leftCenter
Center of left field |
private org.starhope.appius.geometry.Polygon |
leftField
The polygon that contains the dimensions of the left field |
private org.starhope.appius.geometry.Polygon |
net
The polygon that contains the hit space for the net |
private org.starhope.appius.geometry.Coord3D |
realBallLocation
Stores the real location of the volleyball |
private org.starhope.appius.geometry.Coord3D |
realBallVelocity
Stores the real velocity of the volleyball TODO: Change to a vector 3D class |
(package private) ReentrantLock |
realLock
Lock object for updating/reading real coordinates |
private org.starhope.appius.geometry.Coord2D |
rightCenter
Center of right field |
private org.starhope.appius.geometry.Polygon |
rightField
The polygon that contains the dimensions of the right field |
private static long |
serialVersionUID
|
private Room |
volleyballCourt
Soccer field room object |
| Fields inherited from class org.starhope.appius.game.GameEvent |
|---|
freezeTag, gameCode, gameState, players, rooms, scores, scoreWatchRooms |
| Constructor Summary | |
|---|---|
VolleyballCourt(Zone z)
|
|
| Method Summary | |
|---|---|
void |
acceptGameAction(AbstractUser u,
org.json.JSONObject action)
Broadcast message of a game action taking place |
void |
acceptOutOfBandMessage(AbstractUser sender,
Room room,
org.json.JSONObject body)
Accept an out-of-band communications packet that was broadcast to a room in which this Listener is listening. |
void |
acceptPublicMessage(AbstractUser from,
String message)
Accept a public chat message. |
void |
acceptUserAction(Room r,
AbstractUser u)
User actions (go/do actions) propagate through this channel. |
private org.starhope.appius.geometry.Coord2D |
ballLocation()
Gets where the clients think the ball is, taking into account the Z offset (2D projection of 3D coördinates) |
void |
destroySelf()
Cleanup routine to make sure we get garbage collected properly |
(package private) void |
dropBall(org.starhope.appius.geometry.Coord2D coord2d,
double height)
Drops the ball from the given height at the specified coordinates |
String |
getGameEventPrefix()
Get the prefix to be applied to event types for this game |
String |
getName()
Return a user-visible, unique name for this class. |
void |
tick(long currentTime,
long deltaTime)
This method is called periodically from the metronome thread. |
private void |
updateBallLocation()
Updates the ball's location |
| Methods inherited from class org.starhope.appius.game.GameEvent |
|---|
acceptCommand, acceptCommand, acceptGameStateChange, acceptObjectJoinRoom, acceptObjectPartRoom, acceptPublicMessage, acceptUserVariableUpdate, changeGameState, compareTo, decrementScore, disconnect, equals, equals, getCountdownDuration, getEveryone, getGameCode, getGameDuration, getGameShortName, getLeaderBonus, getPlayers, getRoom, getRooms, getScoreWatchRooms, getSpectators, getTimer, getZone, hashCode, incrementScore, propagateGameStateChange, resetPlayers, sendEndEvents, sendStartEvents, toString, updateRoomVars, updateScore, updateScores |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private Volleyball ball
private final org.starhope.appius.geometry.Polygon leftField
private final org.starhope.appius.geometry.Polygon rightField
private final org.starhope.appius.geometry.Polygon net
private final Room volleyballCourt
private final org.starhope.appius.geometry.Coord2D leftCenter
private final org.starhope.appius.geometry.Coord2D rightCenter
private int lastX
private int lastY
private org.starhope.appius.geometry.Coord3D realBallLocation
private org.starhope.appius.geometry.Coord3D realBallVelocity
final ReentrantLock realLock
| Constructor Detail |
|---|
public VolleyballCourt(Zone z)
throws GameLogicException,
NotFoundException
z - zone
GameLogicException - WRITEME
NotFoundException - WRITEME| Method Detail |
|---|
public void acceptGameAction(AbstractUser u,
org.json.JSONObject action)
RoomListener
u - the senderaction - The game action. The verb is in
action.getString("action").RoomListener.acceptGameAction(org.starhope.appius.user.AbstractUser,
org.json.JSONObject)
public void acceptOutOfBandMessage(AbstractUser sender,
Room room,
org.json.JSONObject body)
RoomListener
sender - The sender of the OOB messageroom - The room in which the OOB message is being broadcastbody - A JSON object containing the OOB message. The
contents of this message are not constrained.RoomListener.acceptOutOfBandMessage(org.starhope.appius.user.AbstractUser,
org.starhope.appius.game.Room, org.json.JSONObject)
public void acceptPublicMessage(AbstractUser from,
String message)
RoomListener
from - The speakermessage - The spoken text or /emoteRoomListener.acceptPublicMessage(org.starhope.appius.user.AbstractUser,
java.lang.String)
public void acceptUserAction(Room r,
AbstractUser u)
RoomListener
r - the room in which the user is taking an actionu - the user taking an actionRoomListener.acceptUserAction(org.starhope.appius.game.Room, org.starhope.appius.user.AbstractUser)private org.starhope.appius.geometry.Coord2D ballLocation()
public void destroySelf()
destroySelf in class GameEvent
void dropBall(org.starhope.appius.geometry.Coord2D coord2d,
double height)
coord2d - Drop locationheight - Drop heightpublic String getGameEventPrefix()
GameEvent
getGameEventPrefix in class GameEventGameEvent.getGameEventPrefix()public String getName()
HasName
HasName.getName()
public void tick(long currentTime,
long deltaTime)
throws UserDeadException
AcceptsMetronomeTicks
tick in interface AcceptsMetronomeTickstick in class GameEventcurrentTime - Time since epoch at the start of the global
metronome propagation, as per
System.currentTimeMillis()deltaTime - Delta-time in milliseconds since the prior
global metronome tick
UserDeadException - if a user has died during this tickGameEvent.tick(long, long)private void updateBallLocation()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||