-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharma.hpp
More file actions
171 lines (159 loc) · 3.04 KB
/
arma.hpp
File metadata and controls
171 lines (159 loc) · 3.04 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#ifndef _ARMA_HPP_
#define _ARMA_HPP_
#include <iostream>
#include <vector>
#include <cstdlib>
#include <time.h>
#include "vector3d.hpp"
#include "sonido.hpp"
#include <GL/glut.h>
using namespace std;
using std::vector;
namespace ed{
class Municion
{
private:
vector3d _posicion;
vector3d _objetivo;
vector3d _salida;
float _xrot;
float _yrot;
public:
inline vector3d getPosicion()
{
return _posicion;
}
inline vector3d getObjetivo()
{
return _objetivo;
}
inline float getXrot()
{
return _xrot;
}
inline float getYrot()
{
return _yrot;
}
inline vector3d getSalida()
{
return _salida;
}
inline void setPosicion(vector3d posicion)
{
_posicion = posicion;
}
inline void setObjetivo(vector3d objetivo)
{
_objetivo = objetivo;
}
inline void setXrot(float xrot)
{
_xrot = xrot;
}
inline void setYrot(float yrot)
{
_yrot = yrot;
}
inline void setSalida(vector3d salida)
{
_salida = salida;
}
};
class Arma
{
private:
int _municion;
bool _EsDisparado;
bool _EsAutomatico; //Esto hace que se siga disparando altener presionado el botón izquierdo del raton, sino sería manual
int _dano;
vector3d _posicion;
vector3d _objetivo;
vector3d _salida;
float _xrot;
float _yrot;
vector<Municion> _municionDisparada;
Sonido _sonido;
public:
Arma(float municion = 30, bool EsDisparado = false, bool EsAutomatico = false, float dano = 10)
{
setMunicion(municion);
setDisparado(EsDisparado);
setAutomatico(EsAutomatico);
setDano(dano);
_municionDisparada.resize(0);
};
~Arma(){};
//Observadores
inline float getMunicion() const
{
return _municion;
}
inline bool getDisparado() const
{
return _EsDisparado;
}
inline bool getAutomatico() const
{
return _EsAutomatico;
}
inline float getDano() const
{
return _dano;
}
inline vector3d getPosicion() const
{
return _posicion;
}
inline vector3d getObjetivo() const
{
return _objetivo;
}
inline vector<Municion>* getMunicionDisparada()
{
return &_municionDisparada;
}
inline Municion getMunicionDisparada(int indice)
{
return _municionDisparada[indice];
}
inline Sonido getSonido() const
{
return _sonido;
}
//Modificadores
inline void setMunicion(int municion)
{
_municion = municion;
}
inline void setDisparado(bool EsDisparado)
{
_EsDisparado = EsDisparado;
}
inline void setAutomatico(bool EsAutomatico)
{
_EsAutomatico = EsAutomatico;
}
inline void setDano(float dano)
{
_dano = dano;
}
inline void setPosicion(vector3d posicion)
{
_posicion.setX(posicion.getX());
_posicion.setY(posicion.getY());
_posicion.setZ(posicion.getZ());
}
inline void setObjetivo(vector3d objetivo)
{
_objetivo.setX(objetivo.getX());
_objetivo.setY(objetivo.getY());
_objetivo.setZ(objetivo.getZ());
}
void DibujarArma();
void DibujarProyectil(vector3d posicion, vector3d objetivo, float xrot, float yrot);
void Disparo();
void AumentarMunicion();
};
}
#endif