Пример #1
0
 /* Handles item collection. */
 private void AttemptItemPickup()
 {
     if (Input.GetButtonDown("Fire1"))
     {
         RaycastHit hit;
         if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out hit, 100))
         {
             GameObject objectHit = hit.transform.gameObject;
             SceneItem  sceneItem = objectHit.GetComponent <SceneItem>();
             if (sceneItem)
             {
                 sceneItem.PickupItem(playerInventory);
             }
         }
     }
 }