#ifndef _PLAYER_H #define _PLAYER_H #include #include #include #include "types.h" #include "Cell.h" class Controller; class Player { public: /** * Constructor. **/ Player(void); /** * Constructor with initial values. **/ Player(PlayerNumber PlayerID, Coordinates InitialPoint, VelocityVector initialVel); /** * Destructor. **/ virtual ~Player(void); public: /** * Moves the player along the velocity vector and returns a vector * of all the crossed cells. **/ std::vector move(); /** * Changes the direction (and possibly speed) the player is facing. **/ void setVelocity(VelocityVector v); /** * Apply new coordinates to the player. This is used when starting/restarting the game. **/ void setCoordinates(Coordinates c); /** * Defines the Player ID. **/ void setNumber(PlayerNumber n); /** * Returns the player ID. **/ PlayerNumber getNumber(); /** * Sets the player alive. * It's alive ! ALIIIIIIIIIIIIVE !!! **/ void revive(); /** * (self explanatory) **/ void kill(); /** * Tries to change the direction the player is facing. * Returns false and do nothing if the player is heading the opposite * or the same way. Only possible change is 90°. **/ bool changeDirection(VelocityVector v); /** *Turns toward left **/ void turnLeft(); /** * Turns toward right **/ void turnRight(); /** * Returns the current velocity vector. **/ VelocityVector getVelocity(); /** * Returns the current coordinates. **/ Coordinates getCoordinates(); /** * Returns true if the player is alive. **/ bool isAlive(); /** * Returns the current controller. * NULL when initialized, it is assigned later. **/ Controller* getController(); // may be NULL /** * Defines the controller. **/ void setController(Controller* pController); private: PlayerNumber m_playerID; std::string m_name; Coordinates m_currentCoordinates; VelocityVector m_velocityVector; bool m_alive; Controller* m_pController; }; #endif