summaryrefslogtreecommitdiff
path: root/_ActiveRagdoll/Handlers/RigidbodyHolder.cs
diff options
context:
space:
mode:
Diffstat (limited to '_ActiveRagdoll/Handlers/RigidbodyHolder.cs')
-rw-r--r--_ActiveRagdoll/Handlers/RigidbodyHolder.cs45
1 files changed, 45 insertions, 0 deletions
diff --git a/_ActiveRagdoll/Handlers/RigidbodyHolder.cs b/_ActiveRagdoll/Handlers/RigidbodyHolder.cs
new file mode 100644
index 0000000..3ef0c54
--- /dev/null
+++ b/_ActiveRagdoll/Handlers/RigidbodyHolder.cs
@@ -0,0 +1,45 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+// ±£´æËùÓÐ14¸ö¹Ç÷À
+public class RigidbodyHolder : MonoBehaviour
+{
+ private Rigidbody[] allRigs;
+
+ private WeaponHandler weapons;
+
+ private void Start()
+ {
+ allRigs = GetComponentsInChildren<Rigidbody>();
+ weapons = GetComponent<WeaponHandler>();
+ }
+
+ private void Update()
+ {
+ }
+
+ public Rigidbody[] GetAllRigs()
+ {
+ if (!weapons.leftGun && !weapons.rightGun)
+ {
+ return allRigs;
+ }
+ List<Rigidbody> list = new List<Rigidbody>();
+ for (int i = 0; i < allRigs.Length; i++)
+ {
+ list.Add(allRigs[i]);
+ }
+ if ((bool)weapons)
+ {
+ if ((bool)weapons.leftGun)
+ {
+ list.Add(weapons.leftGun.rig);
+ }
+ if ((bool)weapons.rightGun)
+ {
+ list.Add(weapons.rightGun.rig);
+ }
+ }
+ return list.ToArray();
+ }
+}