Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
LSK_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이상윤
2020-06-18 23:17:38 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a4798a6d35fd199ed638cf522091cb0245671881
a4798a6d
1 parent
80d69a14
트레이너 속도와 끝나는 위치 지정 2020-06-18 11:17 commit
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
27 deletions
sourcecode/capstone/Assets/Script/Move.cs
sourcecode/capstone/Assets/Script/Move.cs
View file @
a4798a6
...
...
@@ -40,6 +40,11 @@ public class Move : MonoBehaviour
public
int
[]
trainer_state
;
public
int
speed
=
0
;
public
int
trainer_count
=
0
;
public
bool
trainer_check
=
true
;
public
bool
trainer_check_outside
=
true
;
public
float
trainer_timer
=
0
;
public
bool
trainer_other_side
=
false
;
public
int
trainer_speed
=
5
;
//lsy end
public
Text
AngleLeftKnee
;
...
...
@@ -71,46 +76,105 @@ public class Move : MonoBehaviour
//lsy
void
Trainer_Run
()
{
if
(!
trainer_check
)
//운동 끝났을 때
{
trainer_timer
+=
Time
.
deltaTime
;
if
(
trainer_timer
>
3
)
{
Debug
.
Log
(
"3초 됨 운동 끝!!!!!"
);
//결과씬이나 다른씬으로
trainer_check_outside
=
false
;
}
return
;
}
//Thread.Sleep(50);
if
(
trainer_j
>=
lines
.
Length
-
3
)
{
if
(
trainer_count
<
20
&&
exercise
==
"Squat"
)
{
trainer_count
++;
Debug
.
Log
(
"카운트 : "
+
trainer_count
);
}
if
(
trainer_count
<
10
&&
exercise
==
"SideHiKick"
)
{
trainer_count
++;
Debug
.
Log
(
"카운트 : "
+
trainer_count
);
}
if
(
trainer_count
<
10
&&
exercise
==
"Lunge"
)
{
trainer_count
++;
Debug
.
Log
(
"카운트 : "
+
trainer_count
);
}
if
(
trainer_count
>=
20
&&
exercise
==
"Squat"
)
{
trainer_check
=
false
;
//스쿼트일때 운동 끝나는 시점!!!!!
}
if
(
trainer_count
>=
10
&&
exercise
==
"SideHiKick"
)
{
if
(!
trainer_other_side
)
{
if
(
trainer_timer
>
3
)
{
trainer_count
=
0
;
lines
=
lines_right
;
trainer_other_side
=
true
;
trainer_timer
=
0
;
}
else
{
trainer_timer
+=
Time
.
deltaTime
;
return
;
}
}
else
{
trainer_check
=
false
;
//사이드하이킥일때 운동 끝나는 시점!!!!!
}
}
if
(
trainer_count
>=
10
&&
exercise
==
"Lunge"
)
{
if
(!
trainer_other_side
)
{
if
(
trainer_timer
>
3
)
{
trainer_speed
=
8
;
trainer_count
=
0
;
lines
=
lines_right
;
trainer_other_side
=
true
;
trainer_timer
=
0
;
}
else
{
trainer_timer
+=
Time
.
deltaTime
;
return
;
}
}
else
{
trainer_check
=
false
;
//사이드하이킥일때 운동 끝나는 시점!!!!!
}
}
trainer_j
=
0
;
return
;
}
trainer_i
=
-
1
;
trainer_data1
=
new
float
[
bodyCount
*
jointCount
*
3
];
trainer_state
=
new
int
[
bodyCount
*
jointCount
];
//Debug.Log("초기화");
//Thread.Sleep(5000);
for
(
int
k
=
0
;
k
<
25
;
k
++)
{
//Debug.Log("trainer_j: " + trainer_j);
//Debug.Log("test1");
//Debug.Log(lines[trainer_j]);
trainer_i
++;
trainer_data1
[
trainer_i
]
=
float
.
Parse
(
lines
[
trainer_j
]);
//Debug.Log("test2" + trainer_i);
trainer_i
++;
trainer_data1
[
trainer_i
]
=
float
.
Parse
(
lines
[
trainer_j
+
1
]);
//Debug.Log("test3" + trainer_i);
trainer_i
++;
trainer_data1
[
trainer_i
]
=
float
.
Parse
(
lines
[
trainer_j
+
2
]);
//Debug.Log("test4" + trainer_i);
if
((
float
.
Parse
(
lines
[
trainer_j
])
+
float
.
Parse
(
lines
[
trainer_j
+
1
])
+
float
.
Parse
(
lines
[
trainer_j
+
2
]))
!=
0
)
{
trainer_state
[
trainer_i
-
2
]
=
1
;
}
//Debug.Log("test4-1");
skeleton_Trainnner
.
dasomset_trainer
(
trainer_data1
,
trainer_state
,
0
,
true
,
true
);
//Debug.Log("test5");
//Debug.Log(trainer_i);
//Debug.Log("메모라인 : " + trainer_j);
trainer_j
=
trainer_j
+
3
;
}
if
(
speed
<
5
)
if
(
speed
<
trainer_speed
)
{
trainer_j
-=
75
;
speed
++;
...
...
@@ -122,22 +186,25 @@ public class Move : MonoBehaviour
speed
=
0
;
}
//Debug.Log("탈출!======================================================");
}
//lsy end
void
Trainee_Count
()
{
void
Trainee_Count
()
{
if
(
exercise
==
"Squat"
)
{
if
(
exercise
==
"Squat"
)
{
workout_flag
=
0
;
workout_flag2
=
0
;
}
else
if
(
exercise
==
"SideHiKick"
)
{
else
if
(
exercise
==
"SideHiKick"
)
{
workout_flag
=
0
;
}
else
if
(
exercise
==
"Lunge"
)
{
else
if
(
exercise
==
"Lunge"
)
{
workout_flag
=
0
;
}
...
...
@@ -159,6 +226,7 @@ public class Move : MonoBehaviour
//lsy end
exercise
=
ClickExercise
.
selected_exercise
;
//ClickExercise에서 선택한 운동이 무엇인지 String으로 넘어옴.
exercise
=
"SideHiKick"
;
Debug
.
Log
(
exercise
);
//Squat, SideHiKick, Lunge 에 따라서 Trainer움직이고, 사용자에게 instruction주기
if
(
exercise
==
"Squat"
)
...
...
@@ -168,19 +236,20 @@ public class Move : MonoBehaviour
}
else
if
(
exercise
==
"SideHiKick"
)
{
lines
=
File
.
ReadAllLines
(
@"Trainer_txt/leg_
lef
t.txt"
);
lines_right
=
File
.
ReadAllLines
(
@"Trainer_txt/leg_
righ
t.txt"
);
lines
=
File
.
ReadAllLines
(
@"Trainer_txt/leg_
righ
t.txt"
);
lines_right
=
File
.
ReadAllLines
(
@"Trainer_txt/leg_
lef
t.txt"
);
Debug
.
Log
(
"읽음"
);
}
else
if
(
exercise
==
"Lunge"
)
{
lines
=
File
.
ReadAllLines
(
@"Trainer_txt/runzi_left.txt"
);
lines_right
=
File
.
ReadAllLines
(
@"Trainer_txt/runzi_right.txt"
);
trainer_speed
=
5
;
lines
=
File
.
ReadAllLines
(
@"Trainer_txt/runzi_right.txt"
);
lines_right
=
File
.
ReadAllLines
(
@"Trainer_txt/runzi_left.txt"
);
Debug
.
Log
(
"읽음"
);
}
else
{
lines
=
File
.
ReadAllLines
(
@"Trainer_txt/
leg_lef
t.txt"
);
else
{
lines
=
File
.
ReadAllLines
(
@"Trainer_txt/
squar
t.txt"
);
Debug
.
Log
(
"읽음"
);
}
...
...
@@ -249,7 +318,8 @@ public class Move : MonoBehaviour
KneeDown6
.
SetActive
(
false
);
}
else
if
(
timer
>=
1
&&
timer
<
2
)
{
else
if
(
timer
>=
1
&&
timer
<
2
)
{
count3
.
SetActive
(
false
);
count2
.
SetActive
(
true
);
count1
.
SetActive
(
false
);
...
...
@@ -286,7 +356,12 @@ public class Move : MonoBehaviour
ex_start
.
SetActive
(
false
);
//lsy
if
(
trainer_check_outside
)
{
Trainer_Run
();
}
//lsy end
...
...
Please
register
or
login
to post a comment