summaryrefslogtreecommitdiff
path: root/_ActiveRagdoll/Handlers/RigidbodyHolder.cs
blob: 3ef0c540e4f96395594bf80270421df6c31b507c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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();
	}
}