Exemple #1
0
    void endCheck()
    {
        //DumbelCoordinator.setBallonText("팔을 천천히 내려 주세요");
        DumbelCoordinator.current_phase = 4;

        if (armpit_Left_Angle <= 95)
        {
            DumbelCoordinator.armpLeftDegree.GetComponent <Text>().color = Color.black;
            wristLeftAngle_Check = true;
        }
        else
        {
            DumbelCoordinator.armpLeftDegree.GetComponent <Text>().color = Color.red;
            wristLeftAngle_Check = false;
        }

        if (armpit_Right_Angle <= 95)
        {
            DumbelCoordinator.armpRightDegree.GetComponent <Text>().color = Color.black;
            wristRightAngle_Check = true;
        }
        else
        {
            DumbelCoordinator.armpRightDegree.GetComponent <Text>().color = Color.red;
            wristRightAngle_Check = false;
        }


        if (wristLeftAngle_Check && wristRightAngle_Check)
        {
            judgment_position();

            // 4,5 ->0

            GameObject PointsText;
            int        ct = 0;
            UnityEngine.Debug.Log("Arm Check");
            for (int i = 0; i < 2; i++)
            {
                UnityEngine.Debug.Log("LeftArm[" + i + "]" + LeftArmDepth[i]);
                UnityEngine.Debug.Log("RightArm[" + i + "]" + RightArmDepth[i]);
                if (!LeftArmDepth[i])
                {
                    ct++;
                }
                if (!RightArmDepth[i])
                {
                    ct++;
                }
            }
            //UnityEngine.Debug.Log("CT = " + ct);
            if (ct == 0)
            {
                if (DumbelCoordinator.practice_On)
                {
                    practice_count++;
                }

                PointsText = UnityEngine.Object.Instantiate(Resources.Load("Prefabs/yosi")) as GameObject;
                //Debug.Log("yosi");
                DumbelCoordinator.changeAni("greet_03");
            }
            else if (ct == 1)
            {
                PointsText = UnityEngine.Object.Instantiate(Resources.Load("Prefabs/soso")) as GameObject;
                DumbelCoordinator.changeAni("pose_00");
            }
            else
            {
                PointsText = UnityEngine.Object.Instantiate(Resources.Load("Prefabs/bad")) as GameObject;
                DumbelCoordinator.changeAni("refuse_01");
                bad_count++;
                //Debug.Log("BAD");
            }

            PointsText.GetComponent <ParticleSystem>().loop = false;
            show_pointText(PointsText);

            end_Flag = true;

            if (DumbelCoordinator.practice_On)
            {
                //Debug.Log(practice_count);
                if (practice_count > 1)
                {
                    practice_count = 0;
                    bad_count      = 0;
                    dumbelCoordi.practice_mod(false);
                    dumbelCoordi.ResumeScreen();
                }
            }


            else
            {
                if (score_Count > 2 || set_Count != 0)
                {
                    if (DumbelCoordinator.count_timer.ElapsedMilliseconds + 2000 > DumbelCoordinator.count_time_avg)
                    {
                        //Debug.Log("SLOW!!");
                        DumbelCoordinator.changeAni("nod_01");
                        //MSGorder = 5;
                    }
                    else
                    {
                        DumbelCoordinator.count_time_avg = (DumbelCoordinator.count_time_avg + DumbelCoordinator.count_timer.ElapsedMilliseconds) / score_Count;
                    }

                    //Debug.Log(DumbelCoordinator.count_timer.ElapsedMilliseconds + " / " + DumbelCoordinator.count_time_avg);
                }
                score_Count++;
                //if(status board is deactivate
                if (!DumbelCoordinator.Status.activeInHierarchy)
                {
                    DumbelCoordinator.Status.SetActive(true);
                }
                //set board txt
                clearBoard();
                setBoard();

                //clear MuscleFail
                LeftArmMuscle[0]  = true;
                LeftArmMuscle[1]  = true;
                RightArmMuscle[0] = true;
                RightArmMuscle[1] = true;
                DumbelCoordinator.count_timer.Reset();

                //if (set_Count == 0 && score_Count == 2)
                //{
                //    //DumbelCoordinator.Status.SetActive(false);
                //    DumbelCoordinator.Status.GetComponent<Image>().material = Resources.Load("blackMaterial") as Material;
                //    DumbelCoordinator.title.transform.parent = GameObject.Find("Canvas").transform;
                //    DumbelCoordinator.Status.GetComponent<RectTransform>().localScale = new Vector3(0.1203983f, 0.118181f, 1f);
                //    DumbelCoordinator.Status.GetComponent<RectTransform>().offsetMin = new Vector2(-462f, -77f);
                //    DumbelCoordinator.Status.GetComponent<RectTransform>().offsetMax = new Vector2(680f, 275f);
                //    DumbelCoordinator.title.transform.parent = DumbelCoordinator.Status.transform;
                //}
            }


            Sound_Controller();
            clearFail();
            ready_Flag = false;
            start_Flag = false;
            top_Flag   = false;
            end_Flag   = false;

            dumbelCoordi.msg2Web("re:" + ready_Flag + " /st:" + start_Flag + " /tp:" + top_Flag + " /en:" + end_Flag);
            dumbelCoordi.msg2Web("after send" + score_Count);
            //Floating Text
            //GameObject PointsText = UnityEngine.Object.Instantiate(Resources.Load("Prefabs/Kinniku")) as GameObject;
            //PointsText.transform.position = new Vector3(DumbelCoordinator.JointInfo["SpineShoulder"].X, DumbelCoordinator.JointInfo["SpineShoulder"].Y);
            if (!DumbelCoordinator.practice_On && bad_count > 2)
            {
                dumbelCoordi.SplitScreen();
            }
        }
    }
Exemple #2
0
    public void depth_Check()
    {
        if ((DumbelCoordinator.JointInfo["ShoulderLeft"].Z - DumbelCoordinator.JointInfo["ElbowLeft"].Z) <= 0.08f)
        {
            ElbowLeftDepthCheck = true;
        }
        else
        {
            ElbowLeftDepthCheck = false;
        }

        if ((DumbelCoordinator.JointInfo["ShoulderRight"].Z - DumbelCoordinator.JointInfo["ElbowRight"].Z) <= 0.08f)
        {
            ElbowRightDepthCheck = true;
        }
        else
        {
            ElbowRightDepthCheck = false;
        }

        if ((DumbelCoordinator.JointInfo["ShoulderLeft"].Z - DumbelCoordinator.JointInfo["WristLeft"].Z) <= 0.15f)
        {
            WristLeftDepthCheck = true;
        }
        else
        {
            WristLeftDepthCheck = false;
        }

        if ((DumbelCoordinator.JointInfo["ShoulderRight"].Z - DumbelCoordinator.JointInfo["WristRight"].Z) <= 0.15f)
        {
            WristRightDepthCheck = true;
        }
        else
        {
            WristRightDepthCheck = false;
        }


        if (!ElbowLeftDepthCheck && !ElbowRightDepthCheck)
        {
            if (DumbelCoordinator.lang == "kr")
            {
                failed_message = "양팔이 너무 앞으로 나왔어요";
            }
            else
            {
                failed_message = "両腕が前に出ました";
            }
        }
        else if (!ElbowLeftDepthCheck && ElbowRightDepthCheck)
        {
            if (DumbelCoordinator.lang == "kr")
            {
                failed_message = "왼팔이 너무 앞으로 나왔어요";
            }
            else
            {
                failed_message = "左腕が前に出ました";
            }
        }
        else if (ElbowLeftDepthCheck && !ElbowRightDepthCheck)
        {
            if (DumbelCoordinator.lang == "kr")
            {
                failed_message = "오른팔이 너무 앞으로 나왔어요";
            }
            else
            {
                failed_message = "右腕が前に出ました";
            }
        }
        else
        {
            failed_message = "";

            if (armpit_Left_Angle > 75 && armpit_Right_Angle > 75)
            {
                if (start_Flag && !top_Flag && (armpit_Left_Angle <= 110 || armpit_Right_Angle <= 110))
                {
                    if (DumbelCoordinator.lang == "kr")
                    {
                        failed_message = "잠깐!!! 팔을 더 올리셔야죠!!";
                    }
                    else
                    {
                        failed_message = "腕をもっと上げてください";
                        DumbelCoordinator.balloon_text.GetComponentInChildren <Text>().resizeTextMaxSize = 33;
                    }
                }
            }
        }
        if (failed_message.Length != 0)
        {
            DumbelCoordinator.changeAni("refuse_01");
            DumbelCoordinator.setBallonText(failed_message);
        }
        else
        {
            //DumbelCoordinator.setBallonText("잘 하고 있어요!");
            DumbelCoordinator.setBallonText("");
            DumbelCoordinator.changeAni("nod_01");
        }
        record_mistake();
    }
Exemple #3
0
    public void Sound_Controller()
    {
        if (judgment[0] + judgment[1] == 2)
        {
            if (DumbelCoordinator.lang == "kr")
            {
                MSGorder = 3;
            }
            else if (DumbelCoordinator.lang == "jp")
            {
                MSGorder = 11;
            }
        }

        else if (judgment[0] == 1)
        {
            if (DumbelCoordinator.lang == "kr")
            {
                MSGorder = 5;
            }
            else if (DumbelCoordinator.lang == "jp")
            {
                MSGorder = 13;
            }
        }
        else if (judgment[1] == 1)
        {
            if (DumbelCoordinator.lang == "kr")
            {
                MSGorder = 6;
            }
            else if (DumbelCoordinator.lang == "jp")
            {
                MSGorder = 14;
            }
        }

        else if (judgment[0] + judgment[1] + judgment[2] + judgment[3] + judgment[4] + judgment[5] == 0)
        {
            if (DumbelCoordinator.lang == "kr")
            {
                MSGorder = 2;
            }
            else if (DumbelCoordinator.lang == "jp")
            {
                MSGorder = 10;
            }
        }


        if (end_Flag)
        {
            if (!DumbelCoordinator.practice_On)
            {
                dumbelCoordi.send2web(score_Count, judgment);
                dumbelCoordi.msg2Web("from Unity score_count" + score_Count.ToString() + "/" + "clear_count" + clear_Score.ToString());

                if ((clear_Score - 1) == score_Count)
                {
                    dumbelCoordi.firewall();
                    DumbelCoordinator.firewall_position = new Vector3(((DumbelCoordinator.JointInfo["FootLeft"].X + DumbelCoordinator.JointInfo["FootRight"].X) / 2), ((DumbelCoordinator.JointInfo["FootLeft"].Y) * 6));
                    DumbelCoordinator.firewall_obj.transform.position = DumbelCoordinator.firewall_position;
                    DumbelCoordinator.firewall_obj.SetActive(true);
                    if (DumbelCoordinator.lang == "kr")
                    {
                        MSGorder = 4;
                    }
                    else if (DumbelCoordinator.lang == "jp")
                    {
                        MSGorder = 12;
                    }
                }
                else if ((clear_Score - 2) == score_Count)
                {
                    if (DumbelCoordinator.lang == "kr")
                    {
                        MSGorder = 0;
                    }
                    else if (DumbelCoordinator.lang == "jp")
                    {
                        MSGorder = 8;
                    }
                }
                else if ((clear_Score - 3) == score_Count)
                {
                    //MSGorder = 8;
                }
                else if ((clear_Score == score_Count))
                {
                    GameObject.Destroy(DumbelCoordinator.firewall_obj);
                    DumbelCoordinator.particle_position           = new Vector3(((DumbelCoordinator.JointInfo["FootLeft"].X + DumbelCoordinator.JointInfo["FootRight"].X) / 2), ((DumbelCoordinator.JointInfo["FootLeft"].Y) * 7));
                    DumbelCoordinator.particle.transform.position = DumbelCoordinator.particle_position;
                    DumbelCoordinator.particle.SetActive(true);
                    DumbelCoordinator.changeAni("greet_03");
                    score_Count = 0;
                    set_Count++;
                    DumbelCoordinator.set_time = DumbelCoordinator.set_timer.Elapsed.ToString().Substring(3, 5);
                    //Debug.Log(DumbelCoordinator.set_time);
                    //MSGorder = 6;
                }
            }
        }
        //Debug.Log("EndClear");
    }