/
StrongUnit2.cpp
71 lines (57 loc) · 1.43 KB
/
StrongUnit2.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
#include "StrongUnit2.h"
#include "constants.h"
#include "lighting.h"
#include "models.h"
#include "shadow.h"
namespace s2_unit {
const int MAX_HP = unit_health::STRONG2;
const int ATK = 8;
const float SPD = unit_speed::STRONG2;
}
using namespace s2_unit;
StrongUnit2::StrongUnit2(float inx, float iny, float inz):
Unit(inx, iny, inz)
{
hp = MAX_HP;
max_hp = MAX_HP;
atk_dmg = ATK;
speed = SPD;
max_speed = SPD;
type = U_STRONG;
value = unit_bonus::STRONG2;
}
StrongUnit2::~StrongUnit2(void) {
}
unit_dir StrongUnit2::move(unit_dir direction) {
return direction;
}
void StrongUnit2::draw() {
glPushMatrix();
glTranslatef(x, y, z);
glPushMatrix();
glPushMatrix();
glTranslatef(0.0,2.3,0.5);
this->drawHealthBar();
glPopMatrix();
glScaled(0.15, 0.15, 0.15);
glTranslatef(0, 10, 0);
double dist = sqrt((getX() - cam.getCamX()) * (getX() - cam.getCamX())
+ (getY() - cam.getCamY()) * (getY() - cam.getCamY())
+ (getZ() - cam.getCamZ()) * (getZ() - cam.getCamZ()));
if (dist <= 10) {
glCallList(vtd_dl::trojanL3DL);
} else if (dist <= 11.5) {
glCallList(vtd_dl::trojanL2DL);
} else {
glCallList(vtd_dl::trojanL1DL);
}
glPopMatrix();
glPushMatrix();
draw_shadow(10);
glPopMatrix();
glPopMatrix();
}
//void StrongUnit2::step(float dt) {
//will be changed by waypoint
// z = z + dt;
//}