Beispiel #1
0
 void Update()
 {
     if (Physics.Raycast(transform.position, transform.forward, out RaycastHit hit, 5f))
     {
         if (Input.GetMouseButtonDown(0))
         {
             interact = hit.collider.GetComponent <IInteract>();
             if (interact != null)
             {
                 interact.OnLeftMouseButton(hit);
                 //Debug.Log(interact);
             }
         }
     }
     if (Input.GetMouseButtonDown(1))
     {
         if (Holding())
         {
             OnDrop();
         }
     }
 }
Beispiel #2
0
 void Update()
 {
     if (Physics.Raycast(transform.position, transform.forward, out RaycastHit hit, 5f))
     {
         if (Input.GetMouseButtonDown(0) && canClick)
         {
             interact = hit.collider.GetComponent <IInteract>();
             if (interact != null)
             {
                 interact.OnLeftMouseButton(hit, this);
                 canClick = false;
                 StartCoroutine(DelayClick());
             }
         }
     }
     if (Input.GetMouseButtonDown(1))
     {
         if (Holding())
         {
             OnDrop();
         }
     }
 }