Пример #1
0
 private void OnCollisionEnter(Collision col) //Net will destroy any gameobjects tagged as Butterfly on collision and add to the total number of butterflies caught.
 {
     if (col.gameObject.CompareTag("Butterfly"))
     {
         Destroy(col.gameObject);
         butterfliesCaught += 1;
         Debug.Log("Number of Butterflies Caught: " + butterfliesCaught);
     }
     else if (col.gameObject.CompareTag("Distractor")) //Keeps track of any distractors that were hit by the net as well.
     {
         haptics.Pulse(1, 130, 75, SteamVR_Input_Sources.LeftHand);
         Debug.Log("That's a distractor, try again!");
         distractorsHit += 1;
     }
 }
Пример #2
0
    private void Update()
    {
        //Trigger Down = Pickup Object
        if (triggerAction.GetStateDown(pose.inputSource))
        {
            print(pose.inputSource + "Trigger Down");

            if (currentInteractable != null)
            {
                currentInteractable.Action();
                return;
            }
            haptics.Pulse(1, 150, 75, SteamVR_Input_Sources.LeftHand);
            Pickup();
        }

        //Touchpad Up = Drop Object
        if (touchpadAction.GetStateDown(pose.inputSource))
        {
            print(pose.inputSource + "Touchpad Up");
            Drop();
        }
    }