-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFoothold.cpp
More file actions
101 lines (88 loc) · 1.94 KB
/
Foothold.cpp
File metadata and controls
101 lines (88 loc) · 1.94 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
#include"Foothold.h"
void Foothold::Init() {
Move = glm::mat4(1.0f);
Scale = glm::mat4(1.0f);
Rotate = glm::mat4(1.0f);
Move = glm::translate(Move, glm::vec3(mx, my, mz));
Scale = glm::scale(Scale, glm::vec3(cx, cy, cz));
if(rx||ry||rz)
Rotate = glm::rotate(Rotate, glm::radians(theta), glm::vec3(rx, ry, rz));
}
void Foothold::Pos_Drawing() {
Drawing = Move * Rotate *Scale ; //애니메이션/카메라 추가 필요
}
void Foothold::Draw_Start() {
Init();
Pos_Drawing();
}
// 플레이어가 발판을 밟으면 StarDel =TRUE로 변경
// StarDel이 TRUE일 동안 Delete()를 호출해서 애니메이션 보여줌
// 애니메이션 끝나면 Del = TRUE로 변경, 발판 삭제
void Foothold::Delete() {
switch (ani) {
case 0:
cx -= 0.1f;
cz -= 0.1f;
if (cx <= 0 && cz <= 0)
Del = TRUE;
break;
case 1:
r += 0.05f;
g += 0.05f;
b += 0.05f;
if (r >= 1 && g >= 1 && b >= 1)
Del = TRUE;
break;
case 2:
ry = TRUE;
theta += 10;
if (theta >= 180)
Del = TRUE;
break;
case 3:
rz = TRUE;
if (theta<0)
theta += rand() % 20;
else
theta -= rand() % 20;
++cnt;
if (cnt >= 10)
Del = TRUE;
break;
case 4:
my -= 0.05f;
++cnt;
if (cnt >= 15)
Del = TRUE;
break;
}
}
void MakeFoothold(vector<Foothold> &Bottom)
{
srand((unsigned int)time(NULL));
float r, g, b;
for (int k = 0; k < N; ++k) {
r = rand()/MAX;
g = rand()/MAX;
b = rand()/MAX;
for (int i = 0; i < N; ++i)
{
for (int j = 0; j < N; ++j)
{
Bottom.push_back(Foothold(-2.0f + (foothold_sizex + 0.1f) * j, 2.0f - 5.0f * k, -2.0f + (foothold_sizez + 0.1f) * i
, r, g, b));
} // -화면크기 + (발판사이즈 + 간격)
}
}
}
void DeleteRandomFoothold(vector<Foothold>& Bottom)
{
for (int i = 0; i < 5; ++i)
{
Bottom[rand() % 25].Del = true;
Bottom[rand() % 25 + 25].Del = true;
Bottom[rand() % 25 + 50].Del = true;
Bottom[rand() % 25 + 75].Del = true;
Bottom[rand() % 25 + 100].Del = true;
}
}