Exemplo n.º 1
0
    void endCheck()
    {
        SideCoordinator.current_phase = 4;

        if (armpit_Left_Angle <= 40)
        {
            SideCoordinator.armpLeftDegree.GetComponent <Text>().color = Color.black;
            wristLeftAngle_Check = true;
        }
        else
        {
            SideCoordinator.armpLeftDegree.GetComponent <Text>().color = Color.red;
            wristLeftAngle_Check = false;
        }
        if (armpit_Right_Angle <= 40)
        {
            SideCoordinator.armpRightDegree.GetComponent <Text>().color = Color.black;
            wristRightAngle_Check = true;
        }
        else
        {
            SideCoordinator.armpRightDegree.GetComponent <Text>().color = Color.red;
            wristRightAngle_Check = false;
        }



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

            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 (SideCoordinator.practice_On)

                {
                    practice_count++;
                }

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

            {
                PointsText = UnityEngine.Object.Instantiate(Resources.Load("Prefabs/bad")) as GameObject;
                SideCoordinator.changeAni("refuse_01");
                bad_count++;
                //Debug.Log("BAD");
            }

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

            end_Flag = true;

            if (SideCoordinator.practice_On)
            {
                //Debug.Log(practice_count);
                if (practice_count > 1)
                {
                    practice_count = 0;
                    bad_count      = 0;
                    sideCoordi.ResumeScreen();
                }
            }


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

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

                //clear MuscleFail
                LeftArmMuscle[0]  = true;
                LeftArmMuscle[1]  = true;
                RightArmMuscle[0] = true;
                RightArmMuscle[1] = true;

                SideCoordinator.count_timer.Reset();
            }


            Sound_Controller();
            clearFail();

            ready_Flag = false;
            start_Flag = false;
            top_Flag   = false;
            end_Flag   = false;



            sideCoordi.msg2Web("re:" + ready_Flag + " /st:" + start_Flag + " /tp:" + top_Flag + " /en:" + end_Flag);
            sideCoordi.msg2Web("after send" + score_Count);
            //Floating Text
            //GameObject PointsText = UnityEngine.Object.Instantiate(Resources.Load("Prefabs/Kinniku")) as GameObject;
            //PointsText.transform.position = new Vector3(SideCoordinator.JointInfo["SpineShoulder"].X, SideCoordinator.JointInfo["SpineShoulder"].Y);

            if (!SideCoordinator.practice_On && bad_count > 2)
            {
                sideCoordi.SplitScreen();
            }
        }
    }