2016-09-27 16:23:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
2016-09-27 20:35:16 +00:00
|
|
|
#include <string>
|
2016-09-27 16:23:58 +00:00
|
|
|
#include <deque>
|
2016-09-28 15:38:32 +00:00
|
|
|
#include <list>
|
2016-09-27 16:23:58 +00:00
|
|
|
|
|
|
|
#include <glm/vec2.hpp>
|
|
|
|
#include <glm/vec3.hpp>
|
|
|
|
|
|
|
|
namespace game {
|
|
|
|
class Ship;
|
|
|
|
class Command;
|
|
|
|
class Missile;
|
|
|
|
|
|
|
|
class Player {
|
|
|
|
public:
|
2016-10-02 21:49:40 +00:00
|
|
|
size_t id;
|
2016-09-27 16:23:58 +00:00
|
|
|
bool alive;
|
2016-09-27 20:35:16 +00:00
|
|
|
float speed;
|
2016-09-27 16:23:58 +00:00
|
|
|
float energy;
|
|
|
|
float deadTimeCounter;
|
2016-10-06 01:30:09 +00:00
|
|
|
glm::vec3 color;
|
2016-09-27 16:23:58 +00:00
|
|
|
Ship *ship;
|
2016-09-27 20:35:16 +00:00
|
|
|
std::string name;
|
2016-09-28 15:38:32 +00:00
|
|
|
std::list<Missile*> missiles;
|
2016-09-27 16:23:58 +00:00
|
|
|
|
2016-10-02 21:49:40 +00:00
|
|
|
Player(size_t id) : id(id), alive(true), speed(1.0), energy(0.0), ship(nullptr), name("<unnamed>")
|
2016-09-27 16:23:58 +00:00
|
|
|
{
|
2016-10-06 01:30:09 +00:00
|
|
|
float h = ((float) rand()) / (float) RAND_MAX;
|
|
|
|
float s = ((float) rand()) / (float) RAND_MAX;
|
|
|
|
float v = ((float) rand()) / (float) RAND_MAX;
|
|
|
|
color =glm::vec3(h,s,v);//glm::gtx::color_space::rgbColor( glm::vec3(h/360.0,1,1)) ;
|
2016-09-27 16:23:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void addCommand(Command *cmd);
|
|
|
|
bool hasCommandInQueue();
|
|
|
|
|
|
|
|
Command *peekCommand();
|
|
|
|
void popCommand();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::deque<Command*> commands;
|
|
|
|
};
|
|
|
|
}
|