1using System.Collections;
2using System.Collections.Generic;
6using Valve.VR.InteractionSystem;
9[RequireComponent(typeof(SkinnedMeshRenderer))]
18 private int holdItemNum = 0;
20 private List<ThrowableCanDisable> items =
new List<ThrowableCanDisable>();
22 private List<Transform> origParents =
new List<Transform>();
24 private float handAlpha = 0f;
29 if (System.IO.File.Exists(
"noExtraHand.bin"))
31 root?.SetActive(
false);
37 return items.Contains(tcd);
42 bool hasSomethingInHand =
false;
43 foreach (var hand
in hands)
45 if (!hand.gameObject.activeInHierarchy)
continue;
47 var cao = hand.currentAttachedObject;
50 foreach (var item
in items)
52 if (item.gameObject == cao)
55 var ao = hand.attachedObjects.First(x => x.attachedObject == cao);
56 ao.originalParent = origParents[i].gameObject;
57 hand.attachedObjects[0] = ao;
58 origParents.RemoveAt(i);
64 hasSomethingInHand =
true;
67 if (hasSomethingInHand)
71 handAlpha += Time.deltaTime;
73 else if (holdItemNum > 0 && handAlpha < 1)
75 handAlpha += Time.deltaTime;
78 else if(holdItemNum == 0)
81 handAlpha -= Time.deltaTime;
84 GetComponent<SkinnedMeshRenderer>().material.color =
new Color(1, 1, 1, handAlpha);
86 private void OnTriggerEnter(Collider other)
92 if (tcd && tcd.IsAttachedToHand())
95 other.gameObject.GetComponentInParent<Rigidbody>().isKinematic =
true;
96 other.gameObject.GetComponentInParent<Rigidbody>().useGravity =
false;
99 origParents.Add(tcd.transform.parent);
100 tcd.gameObject.transform.SetParent(transform,
true);
static HandInventory instance
bool IsInInventory(ThrowableCanDisable tcd)