Class Game


@Node public class Game extends VRObject
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 Details

    • Game

      public Game()
  • Method Details

    • join

      public void join(Client client)
      A client wants to join the game.
      Parameters:
      client -
    • quit

      public void quit(Client client)
      A client left the game
      Parameters:
      client -
    • start

      public void start(Client client)
    • end

      public void end(Client client)
    • processEvent

      public void processEvent(VREvent event)
      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 class VRObject
      Parameters:
      event - Whatever has changed
    • getName

      public String getName()
      Name of the game, supposed to be unique within the world
    • getNumberOfPlayers

      public int getNumberOfPlayers()
      Current number of players
    • getStatus

      public String getStatus()
    • getPlayers

      public Set<ID> getPlayers()
    • setName

      public void setName(String name)
      Name of the game, supposed to be unique within the world
    • setNumberOfPlayers

      public void setNumberOfPlayers(int numberOfPlayers)
      Current number of players
    • setStatus

      public void setStatus(String status)
    • setPlayers

      public void setPlayers(Set<ID> players)
    • toString

      public String toString()
      Overrides:
      toString in class VRObject
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class VRObject
    • canEqual

      protected boolean canEqual(Object other)
      Overrides:
      canEqual in class VRObject
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class VRObject