-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSkills.cpp
84 lines (68 loc) · 1.95 KB
/
Skills.cpp
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "Skills.h"
Skills::Skills()
{
}
Skills::~Skills()
{
}
void Skills::dictionary(Window &window, Game &game)
{
for (unsigned short int i = 0; i < abilities.size(); i++)
{
static unsigned int abilityStreng = 0;
if (abilities[nr][i] == "lopi")
{
glm::vec3 push;
push = window.camera_position + window.camera_direction;
if (glfwGetMouseButton(window.window, GLFW_MOUSE_BUTTON_LEFT) && loader.getTimeAsSeconds() > 0.1 && game.energy.motionEnergy > 0 && !isActiveated.book)
{
abilityStreng++;
pushed = true;
game.energy.motionEnergy -= 1;
loader.restart();
}
else if (!glfwGetMouseButton(window.window, GLFW_MOUSE_BUTTON_LEFT) && pushed)
{
window.camera_position = glm::vec3(push.x, push.y, push.z) + glm::vec3(window.camera_direction.x * abilityStreng, window.camera_direction.y * abilityStreng, window.camera_direction.z * abilityStreng);
abilityStreng = 0;
pushed = false;
}
}
else if (abilities[nr][i] == "seris")
{
if (glfwGetMouseButton(window.window, GLFW_MOUSE_BUTTON_LEFT) && loader.getTimeAsSeconds() > 0.1 && game.energy.lifeEnergy > 0 && !isActiveated.book)
{
pushed = true;
abilityStreng++;
loader.restart();
}
else if (!glfwGetMouseButton(window.window, GLFW_MOUSE_BUTTON_LEFT) && pushed)
{
abilityStreng = 0;
pushed = false;
}
}
}
}
void Skills::sentence(Window &window, MouseAndKeyboard &MAK)
{
static bool isActivate = false;
if (glfwGetKey(window.window, GLFW_KEY_B))
{
isActivate = !isActivate;
isActiveated.book = !isActiveated.book;
}
if (isActivate)
{
std::vector<std::string>word;
ability = MAK.getKeybord(window);
if (MAK.oneKeyPressed(window, GLFW_KEY_ENTER))
{
word.push_back(ability);
}
else if (MAK.oneKeyPressed(window, GLFW_KEY_ENTER) && MAK.oneKeyPressed(window, GLFW_KEY_LEFT_CONTROL))
{
abilities.push_back(word);
}
}
}