Esempio n. 1
0
 void OnMouseUp()
 {
     isBeingHeld = false;
     if (hoveredTarget != null && hoveredTarget.acceptsType == itemType)
     {
         GameManager.Instance.ApplyItem(itemType);
         hoveredTarget.DoTheStuff();
         hoveredTarget.itemHoverExit(itemType);
         Destroy(gameObject);
     }
     else
     {
         if (hoveredTarget != null)
         {
             hoveredTarget.itemHoverExit(itemType);
         }
         Vector3 direction = Camera.main.ScreenToWorldPoint(Input.mousePosition) - anchorHj2d.transform.position;
         Destroy(anchorHj2d.gameObject);
         rb2d.AddForce(100 * direction, ForceMode2D.Impulse);
     }
 }