Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButtonDown("Interact") && lookedAtInteractive != null)
     {
         lookedAtInteractive.InteractWith();
     }
 }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButtonDown("Fire1") && lookedAtInteractive != null)
     {
         Debug.Log("Pressed Fire");
         lookedAtInteractive.InteractWith();
     }
 }
Esempio n. 3
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButtonDown("Interact") && lookedAtInteractive != null)
     {
         Debug.Log("Player pressed the Interact button.");
         lookedAtInteractive.InteractWith();
     }
 }
 private void Update()
 {
     if (Input.GetButtonDown("Interact") && lookedAtInteractive != null)
     {
         Debug.Log("Player has pushed the interact button");
         lookedAtInteractive.InteractWith();
     }
 }
Esempio n. 5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetButtonDown("Interact") && lookedAtInteractive != null)
        {
            //Interacts with the looked at interactive object when the button is pressed.
            lookedAtInteractive.InteractWith();
        }

        if (Input.GetButton("Interact") && lookedAtInteractive != null && heldInteractive == null)
        {
            //Sets an object as being the one that's "held".
            heldInteractive = lookedAtInteractive;
            heldInteractive.HoldInteractive(true);
        }

        if (Input.GetButtonUp("Interact") && heldInteractive != null)
        {
            //Removes object from being "held" causing it to drop.
            heldInteractive.HoldInteractive(false);
            heldInteractive = null;
        }
    }