Showing
2 changed files
with
28 additions
and
13 deletions
... | @@ -14,14 +14,18 @@ public class ClickExercise : MonoBehaviour | ... | @@ -14,14 +14,18 @@ public class ClickExercise : MonoBehaviour |
14 | Vector3 pos; | 14 | Vector3 pos; |
15 | private float timer; | 15 | private float timer; |
16 | 16 | ||
17 | + public static string selected_exercise; | ||
18 | + | ||
17 | private void Start() | 19 | private void Start() |
18 | { | 20 | { |
19 | btnParent = GameObject.Find("BtnGroup").gameObject; // "부모의 이름"으로 찾습니다. | 21 | btnParent = GameObject.Find("BtnGroup").gameObject; // "부모의 이름"으로 찾습니다. |
20 | 22 | ||
21 | follow = GameObject.Find("follow").gameObject; | 23 | follow = GameObject.Find("follow").gameObject; |
22 | pos = follow.transform.position; | 24 | pos = follow.transform.position; |
23 | - follow.transform.position = new Vector3(400, 190, 200); | 25 | + follow.transform.position = new Vector3(400, 0, 200); |
24 | //Debug.Log(pos); | 26 | //Debug.Log(pos); |
27 | + | ||
28 | + selected_exercise = "Squat"; //default로 스쿼트가 선택되어 있으므로 | ||
25 | } | 29 | } |
26 | 30 | ||
27 | /* | 31 | /* |
... | @@ -57,16 +61,19 @@ public class ClickExercise : MonoBehaviour | ... | @@ -57,16 +61,19 @@ public class ClickExercise : MonoBehaviour |
57 | if (btnImage.name == "Squat") | 61 | if (btnImage.name == "Squat") |
58 | { | 62 | { |
59 | Debug.Log("Squat"); | 63 | Debug.Log("Squat"); |
64 | + selected_exercise = "Squat"; | ||
60 | btnImage.texture = Resources.Load("Squat_on", typeof(Texture2D)) as Texture2D; | 65 | btnImage.texture = Resources.Load("Squat_on", typeof(Texture2D)) as Texture2D; |
61 | } | 66 | } |
62 | else if (btnImage.name == "Lunge") | 67 | else if (btnImage.name == "Lunge") |
63 | { | 68 | { |
64 | Debug.Log("Lunge"); | 69 | Debug.Log("Lunge"); |
70 | + selected_exercise = "Lunge"; | ||
65 | btnImage.texture = Resources.Load("Lunge_on", typeof(Texture2D)) as Texture2D; | 71 | btnImage.texture = Resources.Load("Lunge_on", typeof(Texture2D)) as Texture2D; |
66 | } | 72 | } |
67 | else if (btnImage.name == "SideHiKick") | 73 | else if (btnImage.name == "SideHiKick") |
68 | { | 74 | { |
69 | Debug.Log("SideHighKick"); | 75 | Debug.Log("SideHighKick"); |
76 | + selected_exercise = "SideHighKick"; | ||
70 | btnImage.texture = Resources.Load("SideHiKick_on", typeof(Texture2D)) as Texture2D; | 77 | btnImage.texture = Resources.Load("SideHiKick_on", typeof(Texture2D)) as Texture2D; |
71 | } | 78 | } |
72 | 79 | ||
... | @@ -94,6 +101,7 @@ public class ClickExercise : MonoBehaviour | ... | @@ -94,6 +101,7 @@ public class ClickExercise : MonoBehaviour |
94 | { | 101 | { |
95 | Debug.Log("Clicked"); | 102 | Debug.Log("Clicked"); |
96 | ////// | 103 | ////// |
104 | + selected_exercise = "Squat"; //Squat 넘겨줌 | ||
97 | GameObject tempBtn = btnParent.transform.GetChild(3).gameObject; | 105 | GameObject tempBtn = btnParent.transform.GetChild(3).gameObject; |
98 | btnImage = tempBtn.GetComponent<RawImage>(); // 해당 오브젝트의 image 컴포넌트를 받음 | 106 | btnImage = tempBtn.GetComponent<RawImage>(); // 해당 오브젝트의 image 컴포넌트를 받음 |
99 | 107 | ||
... | @@ -114,7 +122,7 @@ public class ClickExercise : MonoBehaviour | ... | @@ -114,7 +122,7 @@ public class ClickExercise : MonoBehaviour |
114 | 122 | ||
115 | } | 123 | } |
116 | else if(pos.x >= 400 && pos.x <= 625 && pos.y >= 335 && pos.y <= 640 && pos.z == 200){ | 124 | else if(pos.x >= 400 && pos.x <= 625 && pos.y >= 335 && pos.y <= 640 && pos.z == 200){ |
117 | - //사이드하이킥 | 125 | + //사이드하이킥 |
118 | timer += Time.deltaTime; | 126 | timer += Time.deltaTime; |
119 | Debug.Log("Timer: " + timer); | 127 | Debug.Log("Timer: " + timer); |
120 | 128 | ||
... | @@ -122,6 +130,7 @@ public class ClickExercise : MonoBehaviour | ... | @@ -122,6 +130,7 @@ public class ClickExercise : MonoBehaviour |
122 | { | 130 | { |
123 | Debug.Log("Clicked"); | 131 | Debug.Log("Clicked"); |
124 | ///// | 132 | ///// |
133 | + selected_exercise = "SideHiKick"; //SideHiKick 넘겨줌 | ||
125 | GameObject tempBtn = btnParent.transform.GetChild(2).gameObject; | 134 | GameObject tempBtn = btnParent.transform.GetChild(2).gameObject; |
126 | btnImage = tempBtn.GetComponent<RawImage>(); // 해당 오브젝트의 image 컴포넌트를 받음 | 135 | btnImage = tempBtn.GetComponent<RawImage>(); // 해당 오브젝트의 image 컴포넌트를 받음 |
127 | 136 | ||
... | @@ -151,6 +160,7 @@ public class ClickExercise : MonoBehaviour | ... | @@ -151,6 +160,7 @@ public class ClickExercise : MonoBehaviour |
151 | { | 160 | { |
152 | Debug.Log("Clicked"); | 161 | Debug.Log("Clicked"); |
153 | ////// | 162 | ////// |
163 | + selected_exercise = "Lunge"; //Lunge 넘겨줌 | ||
154 | 164 | ||
155 | GameObject tempBtn = btnParent.transform.GetChild(1).gameObject; | 165 | GameObject tempBtn = btnParent.transform.GetChild(1).gameObject; |
156 | btnImage = tempBtn.GetComponent<RawImage>(); // 해당 오브젝트의 image 컴포넌트를 받음 | 166 | btnImage = tempBtn.GetComponent<RawImage>(); // 해당 오브젝트의 image 컴포넌트를 받음 | ... | ... |
... | @@ -54,6 +54,8 @@ public class Move : MonoBehaviour | ... | @@ -54,6 +54,8 @@ public class Move : MonoBehaviour |
54 | string hipbal, leftkneewarning, rightkneewarning, leftsidehighkick, rightsidehighkick; | 54 | string hipbal, leftkneewarning, rightkneewarning, leftsidehighkick, rightsidehighkick; |
55 | string spinestraight, pullhipback, great; | 55 | string spinestraight, pullhipback, great; |
56 | 56 | ||
57 | + string exercise; | ||
58 | + | ||
57 | //lsy | 59 | //lsy |
58 | void Trainer_Run() | 60 | void Trainer_Run() |
59 | { | 61 | { |
... | @@ -69,31 +71,31 @@ public class Move : MonoBehaviour | ... | @@ -69,31 +71,31 @@ public class Move : MonoBehaviour |
69 | //Thread.Sleep(5000); | 71 | //Thread.Sleep(5000); |
70 | for (int k = 0; k < 25; k++) | 72 | for (int k = 0; k < 25; k++) |
71 | { | 73 | { |
72 | - Debug.Log("trainer_j: " + trainer_j); | 74 | + //Debug.Log("trainer_j: " + trainer_j); |
73 | - Debug.Log("test1"); | 75 | + //Debug.Log("test1"); |
74 | - Debug.Log(lines[trainer_j]); | 76 | + //Debug.Log(lines[trainer_j]); |
75 | 77 | ||
76 | trainer_i++; | 78 | trainer_i++; |
77 | trainer_data1[trainer_i] = float.Parse(lines[trainer_j]); | 79 | trainer_data1[trainer_i] = float.Parse(lines[trainer_j]); |
78 | - Debug.Log("test2" + trainer_i); | 80 | + //Debug.Log("test2" + trainer_i); |
79 | trainer_i++; | 81 | trainer_i++; |
80 | trainer_data1[trainer_i] = float.Parse(lines[trainer_j + 1]); | 82 | trainer_data1[trainer_i] = float.Parse(lines[trainer_j + 1]); |
81 | - Debug.Log("test3" + trainer_i); | 83 | + //Debug.Log("test3" + trainer_i); |
82 | trainer_i++; | 84 | trainer_i++; |
83 | trainer_data1[trainer_i] = float.Parse(lines[trainer_j + 2]); | 85 | trainer_data1[trainer_i] = float.Parse(lines[trainer_j + 2]); |
84 | - Debug.Log("test4" + trainer_i); | 86 | + //Debug.Log("test4" + trainer_i); |
85 | if ((float.Parse(lines[trainer_j]) + float.Parse(lines[trainer_j + 1]) + float.Parse(lines[trainer_j + 2])) != 0) | 87 | if ((float.Parse(lines[trainer_j]) + float.Parse(lines[trainer_j + 1]) + float.Parse(lines[trainer_j + 2])) != 0) |
86 | { | 88 | { |
87 | trainer_state[trainer_i - 2] = 1; | 89 | trainer_state[trainer_i - 2] = 1; |
88 | } | 90 | } |
89 | - Debug.Log("test4-1"); | 91 | + //Debug.Log("test4-1"); |
90 | skeleton_Trainnner.dasomset_trainer(trainer_data1, trainer_state, 0, true, true); | 92 | skeleton_Trainnner.dasomset_trainer(trainer_data1, trainer_state, 0, true, true); |
91 | - Debug.Log("test5"); | 93 | + //Debug.Log("test5"); |
92 | - Debug.Log(trainer_i); | 94 | + //Debug.Log(trainer_i); |
93 | - Debug.Log("메모라인 : " + trainer_j); | 95 | + //Debug.Log("메모라인 : " + trainer_j); |
94 | trainer_j = trainer_j + 3; | 96 | trainer_j = trainer_j + 3; |
95 | } | 97 | } |
96 | - Debug.Log("탈출!======================================================"); | 98 | + //Debug.Log("탈출!======================================================"); |
97 | } | 99 | } |
98 | //lsy end | 100 | //lsy end |
99 | 101 | ||
... | @@ -108,6 +110,9 @@ public class Move : MonoBehaviour | ... | @@ -108,6 +110,9 @@ public class Move : MonoBehaviour |
108 | lines = File.ReadAllLines(@"..\..\New_TEXT_File.txt"); | 110 | lines = File.ReadAllLines(@"..\..\New_TEXT_File.txt"); |
109 | Debug.Log("읽음"); | 111 | Debug.Log("읽음"); |
110 | //lsy end | 112 | //lsy end |
113 | + | ||
114 | + exercise = ClickExercise.selected_exercise; //ClickExercise에서 선택한 운동이 무엇인지 String으로 넘어옴. | ||
115 | + Debug.Log(exercise); //Squat, SideHiKick, Lunge 에 따라서 Trainer움직이고, 사용자에게 instruction주기 | ||
111 | } | 116 | } |
112 | 117 | ||
113 | private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>() | 118 | private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>() | ... | ... |
-
Please register or login to post a comment