Beispiel #1
0
 public virtual void HandFound()
 {
     if (activeObj)
     {
         activeObj.owner = null;             // Clear reference
         stateController.ChangeState(activeObj.Activate(this));
     }
     else
     {
         stateController.ChangeState(new GodHand());
     }
 }
Beispiel #2
0
	void Start () 
	{
		handType = (BaseTypeHnd)Instantiate(handType, transform.position, Quaternion.identity);
		handType.SetOwner(this);
		handType.name = isRightHand ? "rightHand" : "leftHand";
		
		GetComponent<Renderer>().enabled = false; // Disable visual indicator for Unityhand
		
		if (initialLeapObject)
		{
			initialLeapObject.gameObject.SetActive(true);
			handType.ChangeState(initialLeapObject.Activate(handType));
		}
		
		originalPos = transform.localPosition;

	}
Beispiel #3
0
    public override void OnTriggerStay(Collider c)
    {
        GameObj obj = c.GetComponent <GameObj>();

        if (!handController.activeObj && obj)           //if we're not already holding an object, continue checking closest object to select
        {
            HighlightClosest(obj);
            if (highlightObj != null && obj != highlightObj)
            {
                obj.DeSelect(); return;
            }                                                                                         // Deselect and exit function if this is not the highlighted object

            if (IsGrabbing() && (highlightObj.owner == null || highlightObj.canUseBothHands))
            {
                highlightObj.DeSelect();
                handController.ChangeState(highlightObj.Activate(handController));
            }
        }
    }