raise_hand.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /// <summary>
  2. /// ZWN
  3. /// 20210915
  4. /// </summary>
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. using UnityEngine;
  8. public class raise_hand : MonoBehaviour
  9. {
  10. public int num_virus;//关于病毒是否播放开场视频
  11. public static raise_hand single;
  12. void Awake()
  13. {
  14. single = this;
  15. }
  16. Vector3 Rightwrist = Vector3.zero;
  17. Vector3 Rightelbow = Vector3.zero;
  18. Vector3 Leftwrist = Vector3.zero;
  19. Vector3 Leftelbow = Vector3.zero;
  20. Vector3 default_vec = new Vector3(-1, -1, 0);
  21. public bool Raise_Hand()
  22. {
  23. Rightwrist = Vector3.zero;
  24. Rightelbow = Vector3.zero;
  25. Leftwrist = Vector3.zero;
  26. Leftelbow = Vector3.zero;
  27. if (zwn_common_data.single.zwn_original_pose.Length >= 17)//是否存在整个人
  28. {
  29. //右腕
  30. if (zwn_common_data.single.zwn_original_pose[10] != default_vec)
  31. {
  32. Rightwrist = zwn_common_data.single.zwn_original_pose[10];
  33. }
  34. //右眼
  35. if (zwn_common_data.single.zwn_original_pose[2] != default_vec)
  36. {
  37. Rightelbow = zwn_common_data.single.zwn_original_pose[2];
  38. }
  39. //左腕
  40. if (zwn_common_data.single.zwn_original_pose[9] != default_vec)
  41. {
  42. Leftwrist = zwn_common_data.single.zwn_original_pose[9];
  43. }
  44. //左眼
  45. if (zwn_common_data.single.zwn_original_pose[1] != default_vec)
  46. {
  47. Leftelbow = zwn_common_data.single.zwn_original_pose[1];
  48. }
  49. if (Rightwrist.y == 0 || Rightelbow.y == 0
  50. || Leftwrist.y == 0 || Leftelbow.y == 0)
  51. {
  52. return false;
  53. }
  54. if (Rightwrist.y < Rightelbow.y)
  55. {
  56. return true;
  57. }
  58. else if (Leftwrist.y < Leftelbow.y)
  59. {
  60. return true;
  61. }
  62. return false;
  63. }
  64. return false;
  65. }
  66. /// <summary>
  67. /// 举右手
  68. /// </summary>
  69. /// <returns></returns>
  70. public bool Raise_RightHand()
  71. {
  72. Rightwrist = Vector3.zero;
  73. Rightelbow = Vector3.zero;
  74. if (zwn_common_data.single.zwn_original_pose.Length >= 17)//是否存在整个人
  75. {
  76. //右腕
  77. if (zwn_common_data.single.zwn_original_pose[10] != default_vec)
  78. {
  79. Rightwrist = zwn_common_data.single.zwn_original_pose[10];
  80. }
  81. //右眼
  82. if (zwn_common_data.single.zwn_original_pose[2] != default_vec)
  83. {
  84. Rightelbow = zwn_common_data.single.zwn_original_pose[2];
  85. }
  86. if (Rightwrist.y == 0 || Rightelbow.y == 0)
  87. {
  88. return false;
  89. }
  90. if (Rightwrist.y < Rightelbow.y)
  91. {
  92. return true;
  93. }
  94. return false;
  95. }
  96. return false;
  97. }
  98. /// <summary>
  99. /// 举左手
  100. /// </summary>
  101. /// <returns></returns>
  102. public bool Raise_LeftHand()
  103. {
  104. Leftwrist = Vector3.zero;
  105. Leftelbow = Vector3.zero;
  106. if (zwn_common_data.single.zwn_original_pose.Length >= 17)//是否存在整个人
  107. {
  108. //左腕
  109. if (zwn_common_data.single.zwn_original_pose[9] != default_vec)
  110. {
  111. Leftwrist = zwn_common_data.single.zwn_original_pose[9];
  112. }
  113. //左眼
  114. if (zwn_common_data.single.zwn_original_pose[1] != default_vec)
  115. {
  116. Leftelbow = zwn_common_data.single.zwn_original_pose[1];
  117. }
  118. if (Leftwrist.y == 0 || Leftelbow.y == 0)
  119. {
  120. return false;
  121. }
  122. if (Leftwrist.y < Leftelbow.y)
  123. {
  124. return true;
  125. }
  126. return false;
  127. }
  128. return false;
  129. }
  130. }