|
||||||||||
| 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.SoccerField
public class SoccerField
| Nested Class Summary | |
|---|---|
private static class |
SoccerField.RefPhrases
Just for convenience |
| Field Summary | |
|---|---|
private SoccerBall |
ball
Pointer to the user that represents the soccer ball |
private org.starhope.appius.geometry.Coord2D |
centerField
Center of the field |
private org.starhope.appius.geometry.Coord2D |
entryPoint
Exit points when the soccer ball goes out of bounds |
private org.starhope.appius.geometry.Polygon |
field
The polygon that contains the dimensions of the field |
private org.starhope.appius.geometry.Polygon |
goalLeft
the left-side goal region |
private org.starhope.appius.geometry.Polygon |
goalRight
the right-side goal region |
private boolean |
inGoal
Is the ball in the left goal? |
private long |
lastGoalTime
Last time a goal was made |
private long |
lastTimeMoving
The last time the soccer ball moved |
private int |
leftScore
Score for the left side team |
private boolean |
outOfBounds
Boolean to freeze the ball from colliding |
private AbstractNonPlayerCharacter |
referee
Referee character |
private int |
rightScore
Score for the right side team |
private static long |
serialVersionUID
Serialization ID |
private Room |
soccerField
Soccer field room object |
| Fields inherited from class org.starhope.appius.game.GameEvent |
|---|
freezeTag, gameCode, gameState, players, rooms, scores, scoreWatchRooms |
| Constructor Summary | |
|---|---|
SoccerField(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. |
void |
destroySelf()
Cleanup routine to make sure we get garbage collected properly |
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. |
private void |
speakRefSpeak(SoccerField.RefPhrases phrase)
Mostly because I wanted to make sure Stu isn't spamming speech when no one is around to hear it |
void |
tick(long currentTime,
long deltaTime)
This method is called periodically from the metronome thread. |
| 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 transient SoccerBall ball
private final transient org.starhope.appius.geometry.Coord2D centerField
private transient org.starhope.appius.geometry.Coord2D entryPoint
private final transient org.starhope.appius.geometry.Polygon field
private boolean outOfBounds
private final transient org.starhope.appius.geometry.Polygon goalLeft
private final transient org.starhope.appius.geometry.Polygon goalRight
private long lastTimeMoving
private transient AbstractNonPlayerCharacter referee
private final transient Room soccerField
private boolean inGoal
private int leftScore
private int rightScore
private long lastGoalTime
| Constructor Detail |
|---|
public SoccerField(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)public void destroySelf()
destroySelf in class GameEventpublic String getGameEventPrefix()
GameEvent
getGameEventPrefix in class GameEventGameEvent.getGameEventPrefix()public String getName()
HasName
HasName.getName()private void speakRefSpeak(SoccerField.RefPhrases phrase)
phrase - phrase key
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)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||