public void OnMouseUp() { boneHeld = null; if (BoneBridgeManager.Instance.inputAllowed && !isAttached) { rigBody.gravityScale = 1f; rigBody.freezeRotation = false; rigBody.velocity = Vector2.zero; col.enabled = true; if (leftJoint.TrySnapping()) { isAttached = true; print(gameObject + " isAttached: " + isAttached); } if (rightJoint.TrySnapping()) { isAttached = true; print(gameObject + "isAttached: " + isAttached); } if (!isAttached) { ResetBone(); } } }
public void OnMouseDown() { if (BoneBridgeManager.Instance.inputAllowed && !isAttached) { boneHeld = this; rigBody.gravityScale = 0f; rigBody.freezeRotation = true; transform.rotation = Quaternion.identity; col.enabled = false; transform.SetParent(transform.root); cursorPos = Input.mousePosition; cursorPos.z -= (Camera.main.transform.position.z + 10f); pointerOffset = Camera.main.ScreenToWorldPoint(cursorPos) - transform.position; leftJoint.ActivateJoint(); rightJoint.ActivateJoint(); SoundManager.Instance.PlaySFXClip(bonePickupSfx); } }