private void FindHands() { Transform[] allComponentsInChildren = base.transform.GetAllComponentsInChildren <Transform>(); for (int i = 0; i < allComponentsInChildren.Length; i++) { Transform transform = allComponentsInChildren[i]; if (transform.gameObject.name == "rightHandHeld") { this.rh = transform.GetComponent <itemConstrainToHand>(); if (this.rh && this.lh && this.feet) { break; } } if (transform.gameObject.name == "leftHandHeld") { this.lh = transform.GetComponent <itemConstrainToHand>(); if (this.rh && this.lh && this.feet) { break; } } if (transform.gameObject.name == "char_Hips") { this.feet = transform.GetComponent <itemConstrainToHand>(); if (this.rh && this.lh && this.feet) { break; } } } }
private void Awake() { this._instanceModel = UnityEngine.Object.Instantiate <CoopPlayerVariations>(this._baseModelPrefab); for (int i = this._instanceModel.transform.childCount - 1; i >= 0; i--) { Transform child = this._instanceModel.transform.GetChild(i); if (child.name != "player_BASE") { UnityEngine.Object.DestroyImmediate(child.gameObject); } else { MonoBehaviour[] components = child.GetComponents <MonoBehaviour>(); MonoBehaviour[] array = components; for (int j = 0; j < array.Length; j++) { MonoBehaviour obj = array[j]; UnityEngine.Object.DestroyImmediate(obj); } this._animator = child.GetComponent <Animator>(); } } MonoBehaviour[] components2 = this._instanceModel.GetComponents <MonoBehaviour>(); MonoBehaviour[] array2 = components2; for (int k = 0; k < array2.Length; k++) { MonoBehaviour monoBehaviour = array2[k]; if (!(monoBehaviour is CoopPlayerVariations)) { UnityEngine.Object.DestroyImmediate(monoBehaviour); } } itemConstrainToHand[] componentsInChildren = this._instanceModel.GetComponentsInChildren <itemConstrainToHand>(); itemConstrainToHand[] array3 = componentsInChildren; for (int l = 0; l < array3.Length; l++) { itemConstrainToHand itemConstrainToHand = array3[l]; if (!itemConstrainToHand.fixedItems) { UnityEngine.Object.DestroyImmediate(itemConstrainToHand.gameObject); } } this._instanceModel.transform.parent = base.transform; this._instanceModel.transform.localPosition = Vector3.zero; this._instanceModel.transform.localRotation = Quaternion.identity; }