1using System.Collections;
2using System.Collections.Generic;
3using NaughtyAttributes;
6using Valve.VR.InteractionSystem;
11 private Transform leftHand, rightHand;
12 private HackedHand leftHackedHand, rightHackedHand;
16 private List<GameObject> objectsToPickUp =
new List<GameObject>();
22 planB = GameObject.Find(
"iris_position_helper").transform;
23 leftHand = GameObject.Find(
"LeftHandModelMask").transform;
24 rightHand = GameObject.Find(
"RightHandModelMask").transform;
25 leftHackedHand = leftHand.gameObject.GetComponent<
HackedHand>();
26 rightHackedHand = rightHand.gameObject.GetComponent<
HackedHand>();
27 StartCoroutine(Updater());
30 private IEnumerator Updater()
34 yield
return new WaitForSeconds(1);
35 allThrowables = FindObjectsOfType<ThrowableCanDisable>();
36 yield
return new WaitForSeconds(
Random.value);
42 objectsToPickUp.Clear();
45 var helper = GetComponent<Collider>().bounds;
46 if (allThrowables ==
null)
return;
48 foreach (var throwable
in allThrowables)
53 if (!throwable.enabled)
56 if (throwable.name.Contains(
"front") && (GameObject.Find(
"fake_csavarozas (2)") || GameObject.Find(
"fake_csavarozas (3)")))
61 if ((throwable.GetHand() ==
null || (throwable.GetHand() !=
null && throwable.GetHand().currentAttachedObject != throwable.gameObject)))
63 if (helper.Contains(throwable.transform.position))
65 objectsToPickUp.Add(throwable.gameObject);
70 if (leftHackedHand.currentAttachedObject ==
null && helper.Contains(leftHackedHand.objectAttachmentPoint.position))
72 if (objectsToPickUp.Count > 0)
74 leftHackedHand.
AttachObject(objectsToPickUp[0], GrabTypes.Grip);
75 objectsToPickUp.RemoveAt(0);
79 if (rightHackedHand.currentAttachedObject ==
null && helper.Contains(rightHackedHand.objectAttachmentPoint.position))
81 if (objectsToPickUp.Count > 0)
83 rightHackedHand.
AttachObject(objectsToPickUp[0], GrabTypes.Grip);
84 objectsToPickUp.RemoveAt(0);
override void AttachObject(GameObject objectToAttach, GrabTypes grabbedWithType, AttachmentFlags flags=defaultAttachmentFlags, Transform attachmentOffset=null)