Package pacManReloaded.server

## Class Player

- java.lang.Object
- - pacManReloaded.server.Player

- Direct Known Subclasses:
    `Ghost`, `PacMan`

      public class Player
      extends java.lang.Object

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `Direction` | `direction` |
    `protected INavigator` | `navigator` |
    `java.awt.geom.Point2D.Float` | `position` |
    `protected float` | `speed` |
    `java.awt.geom.Point2D.Float` | `startPoint` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Player()` |
    `Player​(ServerThread client)` | Constructor of the Player

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `changePosition()` | checks the direction of the player, if possible the position of the player will be updated
    `void` | `gameFinished​(boolean gameResult)` | method which handles the finished game
    `ServerThread` | `getClient()` | "getter" for the client(thread)
    `Direction` | `getDirection()` | "getter" for the direction of the player
    `long` | `getMsgSentTime()` | "getter" for the message send time
    `PlayerState` | `getState()` | "getter" for the state of the player
    `void` | `nextMove()` |
    `void` | `sendActorPosition​(java.util.ArrayList<Player> players)` | sends the position of the player and updates it
    `void` | `sendBeginFailed()` | sends the message for the failed begin of a game to the player
    `void` | `sendGameState​(GameState gameState)` | updates the game state and sends it
    `void` | `sendInitGameState​(GameState gameState)` | initialization of the gamestate, sets the status and send it
    `void` | `sendInitPlayer​(java.util.ArrayList<Player> players)` | initialization of the players, decides type of the actor, if PacMan or Ghost
    `void` | `sendMap​(Map map)` | creates the map and sends it, sets postions of each object
    `void` | `sendRemoveObject​(Ball o)` | updates the removal of an object, when a PacMan collects a ball
    `void` | `setDirection​(Direction direction)` | "setter" for the direction of a player
    `void` | `setPosition​(java.awt.geom.Point2D.Float point)` | "setter" for the position of an object
    `void` | `setStartPoint​(java.awt.geom.Point2D.Float point)` | "setter" for the starting point of a player
    `void` | `setState​(PlayerState state)` | "setter" for the state of the player

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### direction

          public Direction direction

    - #### position

          public java.awt.geom.Point2D.Float position

    - #### speed

          protected float speed

    - #### navigator

          protected INavigator navigator

    - #### startPoint

          public java.awt.geom.Point2D.Float startPoint

  - ### Constructor Detail

    - #### Player

          public Player​(ServerThread client)

      Constructor of the Player
      Parameters:
        `client` - thread of the client

    - #### Player

          public Player()

  - ### Method Detail

    - #### getClient

          public ServerThread getClient()

      "getter" for the client(thread)
      Returns:
        the (thread of the) client

    - #### getState

          public PlayerState getState()

      "getter" for the state of the player
      Returns:
        state of the player

    - #### sendMap

          public void sendMap​(Map map)

      creates the map and sends it, sets postions of each object
      Parameters:
        `map` - the map

    - #### sendInitPlayer

          public void sendInitPlayer​(java.util.ArrayList<Player> players)

      initialization of the players, decides type of the actor, if PacMan or Ghost
      Parameters:
        `players` - list of all players

    - #### sendInitGameState

          public void sendInitGameState​(GameState gameState)

      initialization of the gamestate, sets the status and send it
      Parameters:
        `gameState` - current game state

    - #### sendRemoveObject

          public void sendRemoveObject​(Ball o)

      updates the removal of an object, when a PacMan collects a ball
      Parameters:
        `o` - ball to remove

    - #### sendGameState

          public void sendGameState​(GameState gameState)

      updates the game state and sends it

    - #### sendActorPosition

          public void sendActorPosition​(java.util.ArrayList<Player> players)

      sends the position of the player and updates it

    - #### setState

          public void setState​(PlayerState state)

      "setter" for the state of the player
      Parameters:
        `state` - state of the player

    - #### getMsgSentTime

          public long getMsgSentTime()

      "getter" for the message send time
      Returns:
        the sending time of the message

    - #### sendBeginFailed

          public void sendBeginFailed()

      sends the message for the failed begin of a game to the player

    - #### gameFinished

          public void gameFinished​(boolean gameResult)

      method which handles the finished game
      Parameters:
        `gameResult` - - gives the result as boolean. true equals a win and false equals a loss.

    - #### changePosition

          protected void changePosition()

      checks the direction of the player, if possible the position of the player will be updated

    - #### nextMove

          public void nextMove()

    - #### setStartPoint

          public void setStartPoint​(java.awt.geom.Point2D.Float point)

      "setter" for the starting point of a player
      Parameters:
        `point` - the position of the map (startpoint)

    - #### setPosition

          public void setPosition​(java.awt.geom.Point2D.Float point)

      "setter" for the position of an object
      Parameters:
        `point` - the position of the map

    - #### getDirection

          public Direction getDirection()

      "getter" for the direction of the player
      Returns:
        the direction

    - #### setDirection

          public void setDirection​(Direction direction)

      "setter" for the direction of a player
      Parameters:
        `direction` - players direction