Package org.vrspace.server.obj
Class Game
java.lang.Object
org.vrspace.server.obj.Entity
org.vrspace.server.obj.VRObject
org.vrspace.server.obj.Game
A game in a world. Typically does not have mesh, but does have a script, that
implements client-side game logic. It's an active object - all observers
receive events generated by the game.
Game object is Owned - only the Client that created it can change properties.
Games can be persistent, or added by user(s). Depending on the game and world
type, users can opt to join, or may join as soon as they enter the world.
Server-side Game object maintains the list of currently active players, and
provides basic functions to Clients, like joining and leaving the game. Note
that a game members are Clients rather than Users - robots can play games,
why not. The game listens to all events generated by players.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
void
boolean
getName()
Name of the game, supposed to be unique within the worldint
Current number of playersint
hashCode()
void
A client wants to join the game.void
processEvent
(VREvent event) Process a client (player) event.void
A client left the gamevoid
Name of the game, supposed to be unique within the worldvoid
setNumberOfPlayers
(int numberOfPlayers) Current number of playersvoid
setPlayers
(Set<ID> players) void
void
toString()
Methods inherited from class org.vrspace.server.obj.VRObject
active, addChildren, addListener, getActive, getAnimation, getChildren, getListeners, getMesh, getPermanent, getPosition, getProperties, getRotation, getScale, getScript, getTemporary, getWorld, getWorldId, isActive, isPermanent, isTemporary, notifyListeners, passive, removeListener, setActive, setAnimation, setChildren, setListeners, setMesh, setPermanent, setPosition, setProperties, setRotation, setScale, setScript, setTemporary, setWorld, setWorldId
Methods inherited from class org.vrspace.server.obj.Entity
dispose, getId, getObjectId, setId
-
Constructor Details
-
Game
public Game()
-
-
Method Details
-
join
A client wants to join the game.- Parameters:
client
-
-
quit
A client left the game- Parameters:
client
-
-
start
-
end
-
processEvent
Process a client (player) event. This implementation does nothing, only removes the client from the player list on disconnect. CHECKME should we do that, what if they reconnect?- Overrides:
processEvent
in classVRObject
- Parameters:
event
- Whatever has changed
-
getName
Name of the game, supposed to be unique within the world -
getNumberOfPlayers
public int getNumberOfPlayers()Current number of players -
getStatus
-
getPlayers
-
setName
Name of the game, supposed to be unique within the world -
setNumberOfPlayers
public void setNumberOfPlayers(int numberOfPlayers) Current number of players -
setStatus
-
setPlayers
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode()
-