-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.h
68 lines (56 loc) · 2.09 KB
/
player.h
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef PLAYER_H
#define PLAYER_H
#include <chrono>
#include <string>
#include <map>
#include "textures.h"
#include "framebuffer.h"
class Player {
public:
Player(float x_in,
float y_in,
Texture texture_in,
float a_in= M_PI/2.,
float fov_in=M_PI/3.,
int turn_in= 0,
int walk_in= 0,
bool fire_in= 0,
float reloadTime_in= 0,
float speed_in= 0.5,
int life_in= 100);
float x, y; // position
Texture texture; //texture to put gun for instance
float a; // view direction
float fov; // field of view
int turn, walk;
bool fire;
float reloadTime;
float speed;
int life;
// weapons parameters
struct Weapon {
float distShoot; //in wall size 16 usually
size_t weapongDmgs; //dmgs the weapon can make with 1 shoot to the monsters
std::vector<int> weapon_text_ids;
int weapon_text_id;
Weapon(const float distShoot_in,const size_t weapongDmgs_in,const std::vector<int> weapon_text_ids_in):
distShoot(distShoot_in),weapongDmgs(weapongDmgs_in),weapon_text_ids(weapon_text_ids_in){
weapon_text_id = weapon_text_ids[0];
}
};
Weapon currentWeapon; //needs to be initalized
std::map<std::string, Weapon> animationWeaponsMap; //map that contains the animations vector depending on the weapon (the key)
std::map<std::string, Weapon>::iterator animationWeaponsMapIterator;
std::string weaponName = "gun";
//weapon animation parameters
bool animationFinished = true;
std::chrono::duration<double, std::ratio<1>> timeDurationCurrentAnime_secs;
std::chrono::time_point<std::chrono::high_resolution_clock> timeStartedAnime_secs = std::chrono::high_resolution_clock::now();
std::vector<std::chrono::duration<double, std::ratio<1>>> fireAnimationTimes_secs;
virtual void drawVisor(FrameBuffer &fb);
virtual void drawLifeJauge(FrameBuffer &fb);
virtual void drawWeapon(FrameBuffer &fb);
virtual void animate();
virtual void render(FrameBuffer &fb);
};
#endif // PLAYER_H