Beispiel #1
0
 public void Interact()
 {
     if (currentInteractable)
     {
         //Debug.Log("OnInteract");
         currentInteractable.actor = this;
         currentInteractable.BeginInteraction();
     }
 }
Beispiel #2
0
    void BeginInteraction(Interactable interactable)
    {
        if (_Debug)
        {
            print(name + " begun interaction with " + interactable.gameObject.name + "  from layer " + interactable.gameObject.layer.ToString());
        }

        if (interactable.gameObject.layer == SRLayers.Echidna)
        {
            SetState(State.InteractingEchidna);
            EchidnaController echidna = _ActiveInteractable.gameObject.GetComponent <EchidnaController>();
        }
        else if (interactable.gameObject.layer == SRLayers.Interactables)
        {
            SetState(State.InteractingEnvironment);
        }

        _ActiveInteractable = interactable;
        _ActiveInteractable.BeginInteraction(this);
    }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        UpdateFingers();
        if (PausePlayManager.instance.running)
        {
            if (currentInteraction)
            {
                currentInteraction.EndInteraction();
                currentInteraction = null;
            }

            return;
        }

        if (controller.input.GetPressDown(SteamVR_Controller.ButtonMask.Trigger) && !currentInteraction)
        {
            Interactable i = getInteractible();
            if (i && i.BeginInteraction(controller, 0))
            {
                currentInteraction = i;
            }
        }

        if (controller.input.GetPressDown(SteamVR_Controller.ButtonMask.Grip) && !currentInteraction)
        {
            Interactable i = getInteractible();
            if (i && i.BeginInteraction(controller, 1))
            {
                currentInteraction = i;
            }
        }

        if ((controller.input.GetPressUp(SteamVR_Controller.ButtonMask.Grip) || controller.input.GetPressUp(SteamVR_Controller.ButtonMask.Trigger)) && currentInteraction)
        {
            currentInteraction.EndInteraction();
            currentInteraction = null;
        }
    }