Ejemplo n.º 1
0
    void Awake()
    {
        minAngle    = MinAngle;
        maxAngle    = MaxAngle;
        offsetAngle = OffsetAngle;

        baseRotation  = transform.rotation;
        triggerScript = GetComponent <TriggerAudio> ();
    }
Ejemplo n.º 2
0
    void Awake()
    {
        allChildren   = gameObject.GetComponentsInChildren <Rigidbody>();
        triggerScript = GetComponent <TriggerAudio> ();

        maxVel = MaxVel;

        timerVal = TimerVal;
        timer    = timerVal;
    }
Ejemplo n.º 3
0
    void Awake()
    {
        trackedObject = GetComponent <SteamVR_TrackedObject>();

        hand         = Hand;
        handAnimator = hand.GetComponent <Animator> ();

        isGrabbing = false;

        grabSound    = GrabSound;
        releaseSound = ReleaseSound;

        triggerScript = GetComponent <TriggerAudio> ();
    }
Ejemplo n.º 4
0
    void OnTriggerStay(Collider col)
    {
        if (device == null)
        {
            return;
        }

        // Grab a single object
        if (device.GetTouch(triggerButton) && (col.attachedRigidbody != null) &&
            (grabbedObject == null))
        {
            if (!col.attachedRigidbody.isKinematic)
            {
                grabbedObject = col.gameObject;
                Debug.Log("grabbedObject: " + grabbedObject.name);

                col.attachedRigidbody.isKinematic = true;
                grabbedObject.transform.SetParent(gameObject.transform);

                TriggerAudio grabbedTriggerScript = grabbedObject.GetComponent <TriggerAudio> ();
                if (grabbedTriggerScript != null)
                {
                    grabbedTriggerScript.MakeContact();
                }
            }
            else if (col.gameObject.name.Contains("door") || col.gameObject.name.Contains("lamp_head"))
            {
                grabbedObject = col.gameObject;
                Debug.Log("grabbedObject: " + grabbedObject.name);

                DoorBehavior doorScript = grabbedObject.GetComponent <DoorBehavior>();
                doorScript.GrabDoor(gameObject);
            }
        }
//		// Release/toss an object
//		if ((col.gameObject == grabbedObject) && device.GetTouchUp (triggerButton)) {
//
//			if (grabbedObject.name.Contains ("door")) {
//				DoorBehavior doorScript = grabbedObject.GetComponent<DoorBehavior>();
//				doorScript.ReleaseDoor ();
//				grabbedObject = null;
//			} else {
//				grabbedObject.transform.SetParent (null);
//				col.attachedRigidbody.isKinematic = false;
//				tossObject (col.attachedRigidbody);
//				grabbedObject = null;
//			}
//		}
    }