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; } } }
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); } } }