고다경

Start Scene에서 Humanoid Scene으로 무슨 운동 선택했는지 변수 넘겨줌.

......@@ -14,14 +14,18 @@ public class ClickExercise : MonoBehaviour
Vector3 pos;
private float timer;
public static string selected_exercise;
private void Start()
{
btnParent = GameObject.Find("BtnGroup").gameObject; // "부모의 이름"으로 찾습니다.
follow = GameObject.Find("follow").gameObject;
pos = follow.transform.position;
follow.transform.position = new Vector3(400, 190, 200);
follow.transform.position = new Vector3(400, 0, 200);
//Debug.Log(pos);
selected_exercise = "Squat"; //default로 스쿼트가 선택되어 있으므로
}
/*
......@@ -57,16 +61,19 @@ public class ClickExercise : MonoBehaviour
if (btnImage.name == "Squat")
{
Debug.Log("Squat");
selected_exercise = "Squat";
btnImage.texture = Resources.Load("Squat_on", typeof(Texture2D)) as Texture2D;
}
else if (btnImage.name == "Lunge")
{
Debug.Log("Lunge");
selected_exercise = "Lunge";
btnImage.texture = Resources.Load("Lunge_on", typeof(Texture2D)) as Texture2D;
}
else if (btnImage.name == "SideHiKick")
{
Debug.Log("SideHighKick");
selected_exercise = "SideHighKick";
btnImage.texture = Resources.Load("SideHiKick_on", typeof(Texture2D)) as Texture2D;
}
......@@ -94,6 +101,7 @@ public class ClickExercise : MonoBehaviour
{
Debug.Log("Clicked");
//////
selected_exercise = "Squat"; //Squat 넘겨줌
GameObject tempBtn = btnParent.transform.GetChild(3).gameObject;
btnImage = tempBtn.GetComponent<RawImage>(); // 해당 오브젝트의 image 컴포넌트를 받음
......@@ -114,7 +122,7 @@ public class ClickExercise : MonoBehaviour
}
else if(pos.x >= 400 && pos.x <= 625 && pos.y >= 335 && pos.y <= 640 && pos.z == 200){
//사이드하이킥
//사이드하이킥
timer += Time.deltaTime;
Debug.Log("Timer: " + timer);
......@@ -122,6 +130,7 @@ public class ClickExercise : MonoBehaviour
{
Debug.Log("Clicked");
/////
selected_exercise = "SideHiKick"; //SideHiKick 넘겨줌
GameObject tempBtn = btnParent.transform.GetChild(2).gameObject;
btnImage = tempBtn.GetComponent<RawImage>(); // 해당 오브젝트의 image 컴포넌트를 받음
......@@ -151,6 +160,7 @@ public class ClickExercise : MonoBehaviour
{
Debug.Log("Clicked");
//////
selected_exercise = "Lunge"; //Lunge 넘겨줌
GameObject tempBtn = btnParent.transform.GetChild(1).gameObject;
btnImage = tempBtn.GetComponent<RawImage>(); // 해당 오브젝트의 image 컴포넌트를 받음
......
......@@ -54,6 +54,8 @@ public class Move : MonoBehaviour
string hipbal, leftkneewarning, rightkneewarning, leftsidehighkick, rightsidehighkick;
string spinestraight, pullhipback, great;
string exercise;
//lsy
void Trainer_Run()
{
......@@ -69,31 +71,31 @@ public class Move : MonoBehaviour
//Thread.Sleep(5000);
for (int k = 0; k < 25; k++)
{
Debug.Log("trainer_j: " + trainer_j);
Debug.Log("test1");
Debug.Log(lines[trainer_j]);
//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);
//Debug.Log("test2" + trainer_i);
trainer_i++;
trainer_data1[trainer_i] = float.Parse(lines[trainer_j + 1]);
Debug.Log("test3" + trainer_i);
//Debug.Log("test3" + trainer_i);
trainer_i++;
trainer_data1[trainer_i] = float.Parse(lines[trainer_j + 2]);
Debug.Log("test4" + trainer_i);
//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");
//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);
//Debug.Log("test5");
//Debug.Log(trainer_i);
//Debug.Log("메모라인 : " + trainer_j);
trainer_j = trainer_j + 3;
}
Debug.Log("탈출!======================================================");
//Debug.Log("탈출!======================================================");
}
//lsy end
......@@ -108,6 +110,9 @@ public class Move : MonoBehaviour
lines = File.ReadAllLines(@"..\..\New_TEXT_File.txt");
Debug.Log("읽음");
//lsy end
exercise = ClickExercise.selected_exercise; //ClickExercise에서 선택한 운동이 무엇인지 String으로 넘어옴.
Debug.Log(exercise); //Squat, SideHiKick, Lunge 에 따라서 Trainer움직이고, 사용자에게 instruction주기
}
private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>()
......