Пример #1
0
        private void FistInWaist(List <OutPutData> lstVet, int i)
        {
            bool RightFistInWaist = false;
            bool LeftFistInWaist  = false;

            //叉腰动作

            if (lstVet[i].score < 0.5 || lstVet[i - 1].score < 0.5 || lstVet[i - 2].score < 0.5 ||
                lstVet[i + 3].score < 0.5 || lstVet[i + 2].score < 0.5 || lstVet[i + 1].score < 0.5)
            {
                StopSoundEffect(0);
                FistInWaistFrameCount = 0;
                return;
            }
            RightFistInWaist = ARHumanBodyDataParse.fistInWaistRight(lstVet[i].VectorScreenPos, lstVet[i - 1].VectorScreenPos, lstVet[i - 2].VectorScreenPos, lstVet[i + 4].VectorScreenPos);
            LeftFistInWaist  = ARHumanBodyDataParse.fistInWaistLeft(lstVet[i + 3].VectorScreenPos, lstVet[i + 2].VectorScreenPos, lstVet[i + 1].VectorScreenPos, lstVet[i + 7].VectorScreenPos);

            if (RightFistInWaist && LeftFistInWaist)
            {
                Static_pose[0].transform.position = ARHumanBodyDataParse.GetGroundVet(lstVet[0].VectorScreenPos, 0, (int)(300 * ARHumanBodyDataParse.lengthShoulder / 600), 1000 / ARHumanBodyDataParse.lengthShoulder);
                wistTogether = false;
                FistInWaistFrameCount++;
                if (FistInWaistFrameCount < DomainNumber) //5帧才认
                {
                    return;
                }
                //表示叉腰动作
                if (!Static_pose[0].activeSelf)
                {
                    Static_pose[0].SetActive(true);
                    //特效消失
                    if (Static_pose[1].activeSelf)
                    {
                        Static_pose[1].SetActive(false);
                    }
                }

                if (!audios[0].activeSelf)
                {
                    audios[0].SetActive(true);
                    if (audios[1].activeSelf)
                    {
                        audios[1].SetActive(false);
                    }
                }

                return;
            }
            else
            {
                //动作消失
                StopSoundEffect(0);
                FistInWaistFrameCount = 0;
            }
        }
Пример #2
0
        private void StartEffect(Vector3 vet, int index)
        {
            if (Time.time - deltime < 1)
            {
                return;
            }
            deltime = Time.time;
            //  ARDebug.Log("vet.x = "+vet.x + " vet.y ="+vet.y +" vet.z = "+vet.z);
            Vector3 vetRet = ARHumanBodyDataParse.GetGroundVet(vet, 0, -60, 5000 / ARHumanBodyDataParse.lengthShoulder);

            //  if (goEffect[index] == null){
            goEffect[index] = Instantiate(FootLiftEffect[index]) as GameObject;
            goEffect[index].SetActive(true);
            goEffect[index].transform.position = vetRet;
            //}
        }
Пример #3
0
        private void FistFrontIn(List <OutPutData> lstVet, int i)
        {
            bool RightFistFrontChest = false;
            bool LeftFistFrontChest  = false;

            bool RightFistFrontTo = false;
            bool LeftFistFrontTo  = false;

            if (lstVet[i].score < 0.5 || lstVet[i - 1].score < 0.5 || lstVet[i - 2].score < 0.5 ||
                lstVet[i + 3].score < 0.5 || lstVet[i + 2].score < 0.5 || lstVet[i + 1].score < 0.5)
            {
                return;
            }

            RightFistFrontChest = ARHumanBodyDataParse.fistFrontChestRight(lstVet[i].VectorScreenPos, lstVet[i - 1].VectorScreenPos, lstVet[i - 2].VectorScreenPos, lstVet[i + 4].VectorScreenPos);
            LeftFistFrontChest  = ARHumanBodyDataParse.fistFrontChestLeft(lstVet[i + 3].VectorScreenPos, lstVet[i + 2].VectorScreenPos, lstVet[i + 1].VectorScreenPos, lstVet[i + 7].VectorScreenPos);

            if (RightFistFrontChest && LeftFistFrontChest)
            {
                IsWistFrontChest = true;
            }

            if (IsWistFrontChest)
            {
                //双掌向前推动作
                RightFistFrontTo = ARHumanBodyDataParse.fistFrontToRight(lstVet[i].VectorScreenPos, lstVet[i - 1].VectorScreenPos, lstVet[i - 2].VectorScreenPos, lstVet[i + 4].VectorScreenPos);
                LeftFistFrontTo  = ARHumanBodyDataParse.fistFrontToLeft(lstVet[i + 3].VectorScreenPos, lstVet[i + 2].VectorScreenPos, lstVet[i + 1].VectorScreenPos, lstVet[i + 7].VectorScreenPos);


                if (RightFistFrontTo && LeftFistFrontTo)
                {
                    if (ARHumanBodyDataParse.FistIntenal(lstVet[i - 1].VectorScreenPos, lstVet[i].VectorScreenPos) &&
                        ARHumanBodyDataParse.FistIntenal(lstVet[i + 3].VectorScreenPos, lstVet[i + 2].VectorScreenPos))
                    {
                        return;
                    }
                    IsWistFrontChest         = false;
                    wistTogether             = false;
                    FistFrontChestFrameCount = DomainNumber + 5;
                    StopCoroutine("WaitFrontChestEnable");
                    //时间到了消失
                    if (!Static_pose[2].activeSelf)
                    {
                        Static_pose[2].SetActive(true);
                    }
                    Static_pose[2].GetComponent <ParticleSystem>().Play();
                    Vector3 centerChest = (lstVet[i].VectorScreenPos + lstVet[i + 3].VectorScreenPos) / 2;
                    //  Vector2 centerChest = new Vector2((lstVet[i].VectorScreenPos.x + lstVet[i +3].VectorScreenPos.x)/2,(lstVet[i].VectorScreenPos.y + lstVet[i + 3].VectorScreenPos.y)/2);
                    ARDebug.Log("my = " + centerChest.x + "  " + centerChest.y);

                    float distance = Vector2.Distance(lstVet[i].VectorScreenPos, lstVet[i + 3].VectorScreenPos);
                    ARDebug.Log("distance = " + distance);
                    float z = 20;
                    z = z * 500 / distance;
                    Static_pose[2].transform.position = ARHumanBodyDataParse.GetGroundVet(centerChest, 0, 0, 1000 / ARHumanBodyDataParse.lengthShoulder);
                    //Static_pose[2].transform.position = ARBodyDataParse.GetGroundVet(centerChest, 0, 0, 2);
                    //双掌向前推动作
                    ARDebug.Log("chayao wistFront");

                    if (!audios[2].activeSelf)
                    {
                        audios[2].SetActive(true);
                    }
                    audios[2].GetComponent <AudioSource>().Play();
                    return;
                }
            }
        }
Пример #4
0
        private void FistFrontChest(List <OutPutData> lstVet, int i)
        {
            bool RightFistFrontChest = false;
            bool LeftFistFrontChest  = false;

            if (lstVet[i].score < 0.5 || lstVet[i - 1].score < 0.5 || lstVet[i - 2].score < 0.5 ||
                lstVet[i + 3].score < 0.5 || lstVet[i + 2].score < 0.5 || lstVet[i + 1].score < 0.5)
            {
                StopSoundEffect(1);
                return;
            }

            if (!wistTogether)
            {
                RightFistFrontChest = ARHumanBodyDataParse.fistFrontChestRight(lstVet[i].VectorScreenPos, lstVet[i - 1].VectorScreenPos, lstVet[i - 2].VectorScreenPos, lstVet[i + 4].VectorScreenPos);;
                LeftFistFrontChest  = ARHumanBodyDataParse.fistFrontChestLeft(lstVet[i + 3].VectorScreenPos, lstVet[i + 2].VectorScreenPos, lstVet[i + 1].VectorScreenPos, lstVet[i + 7].VectorScreenPos);
                if (RightFistFrontChest && LeftFistFrontChest)
                {
                    if (ARHumanBodyDataParse.fistTogether(lstVet[i].VectorScreenPos, lstVet[i + 3].VectorScreenPos))
                    {
                        wistTogether = true;
                    }
                }
            }

            if (wistTogether)
            {
                //双掌在胸前的动作
                RightFistFrontChest = ARHumanBodyDataParse.fistFrontChestRight(lstVet[i].VectorScreenPos, lstVet[i - 1].VectorScreenPos, lstVet[i - 2].VectorScreenPos, lstVet[i + 4].VectorScreenPos);;
                LeftFistFrontChest  = ARHumanBodyDataParse.fistFrontChestLeft(lstVet[i + 3].VectorScreenPos, lstVet[i + 2].VectorScreenPos, lstVet[i + 1].VectorScreenPos, lstVet[i + 7].VectorScreenPos);

                if (RightFistFrontChest && LeftFistFrontChest)
                {
                    FistFrontChestFrameCount = 0;
                    //双掌在胸前动作
                    StopCoroutine("WaitFrontChestEnable");
                    StartCoroutine("WaitFrontChestEnable");
                    ARDebug.Log("chayao chestFront");

                    Vector3 centerChest = (lstVet[i].VectorScreenPos + lstVet[i + 3].VectorScreenPos) / 2;
                    centerChest.y = centerChest.y + ARHumanBodyDataParse.lengthShoulder / 20;
                    //  Vector2 centerChest = new Vector2((lstVet[i].VectorScreenPos.x + lstVet[i +3].VectorScreenPos.x)/2,(lstVet[i].VectorScreenPos.y + lstVet[i + 3].VectorScreenPos.y)/2);
                    ARDebug.Log("my = " + centerChest.x + "  " + centerChest.y);

                    float distance = Vector2.Distance(lstVet[i].VectorScreenPos, lstVet[i + 3].VectorScreenPos);
                    float z        = 20;
                    z = z * 500 / distance;
                    Static_pose[1].transform.position = ARHumanBodyDataParse.GetGroundVet(centerChest, 0, 0, z);

                    if (!audios[1].activeSelf)
                    {
                        audios[1].SetActive(true);
                    }
                    ARDebug.Log("chayao chestFront Hinde");
                    if (!Static_pose[1].activeSelf)
                    {
                        Static_pose[1].SetActive(true);
                    }
                    audios[0].SetActive(false);

                    return;
                }
                else
                {
                    FistFrontChestFrameCount++;
                    if (FistFrontChestFrameCount > (DomainNumber - 3))
                    {
                        StopSoundEffect(1);
                    }
                }
            }
            else
            {
                //特效消失
                FistFrontChestFrameCount++;
                if (FistFrontChestFrameCount > (DomainNumber - 3))
                {
                    StopSoundEffect(1);
                }
            }
        }