public override void Update(HeldObject heldObject)
 {
     if (!heldObject.playerInRange)
     {
         if (heldObject.displayImage != null)
         {
             heldObject.ToggleImage(false);
         }
         heldObject.TransitionToState(heldObject.idleState);
     }
     else
     {
         RaycastHit hit;
         int        layerMask = 1 << 10;
         bool       mouseOver = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 50, layerMask, QueryTriggerInteraction.Ignore);
         if (mouseOver && hit.transform.name == heldObject.name)
         {
             if (Input.GetKeyDown(KeyCode.Mouse0))
             {
                 ObjectPickedUp(heldObject);
             }
         }
         else
         {
             if (heldObject.displayImage != null)
             {
                 heldObject.ToggleImage(false);
             }
             heldObject.TransitionToState(heldObject.inRangeState);
         }
     }
 }
Ejemplo n.º 2
0
 public override void ObjectDropped(HeldObject droppedObject)
 {
     droppedObject.rb.constraints = RigidbodyConstraints.None;
     droppedObject.rb.useGravity  = true;
     droppedObject.Player.DropObject(droppedObject.gameObject);
     droppedObject.TransitionToState(droppedObject.selectedState);
 }
Ejemplo n.º 3
0
 public override void Update(HeldObject heldObject)
 {
     if (heldObject.playerInRange)
     {
         heldObject.TransitionToState(heldObject.inRangeState);
     }
 }
Ejemplo n.º 4
0
 public override void Update(HeldObject heldObject)
 {
     if (!heldObject.playerInRange)
     {
         heldObject.TransitionToState(heldObject.idleState);
     }
     else
     {
         RaycastHit hit;
         int        layerMask = 1 << 10;
         bool       mouseOver = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 50, layerMask, QueryTriggerInteraction.Ignore);
         if (mouseOver && hit.transform.name == heldObject.name)
         {
             heldObject.TransitionToState(heldObject.selectedState);
         }
     }
 }
 public override void ObjectPickedUp(HeldObject pickedUpObject)
 {
     pickedUpObject.outlineObject.SetActive(false);
     pickedUpObject.rb.constraints = RigidbodyConstraints.FreezeRotation;
     pickedUpObject.rb.useGravity  = false;
     pickedUpObject.Player.PickupObject(pickedUpObject.gameObject);
     pickedUpObject.TransitionToState(pickedUpObject.pickedUpState);
 }