summaryrefslogtreecommitdiffstats
path: root/Player.h
blob: ce6af6ae944cdb0fb65fd6233dcaa4a3b2c25d03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef _PLAYER_H
#define _PLAYER_H

#include <vector>
#include <string>
#include <stdlib.h>
#include "types.h"
#include "Cell.h"

class Controller;

class Player
{
public:
	Player(PlayerNumber PlayerID, Coordinates InitialPoint, VelocityVector initialVel);
	virtual ~Player(void);

public:
	/**
	 * Moves the player along the velocity vector and returns a vector
	 * of all the crossed cells.
	 **/
	std::vector<Coordinates> move();
	void setVelocityVector(VelocityVector v);
	/**
	 * 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);
	void turnLeft();
	void turnRight();

	bool isAlive();
	void kill();

	PlayerNumber getNumber();

private:
	PlayerNumber    m_playerID;
	std::string     m_name;
	Coordinates     m_currentCoordinates;
	VelocityVector  m_velocityVector;
	bool            m_alive;
	Controller*     m_controller;
};

#endif