private void OnMouseDown() { // Initialize the script by retrieving them from the ones attached to the game object moveAction = GetComponent <IMoveItem>(); mousePosition = GetComponent <IMousePosition>(); rb.isKinematic = true; offset = gameObject.transform.position - mousePosition.GetMousePosition(); prevMousePos = mousePosition.GetMousePosition(); }
IMousePosition mousePosition; // Helps in getting the mouse position private void Awake() { // Initialize the script by retrieving them from the ones attached to the game object moveAction = GetComponent <IMoveItem>(); mousePosition = GetComponent <IMousePosition>(); }