public void TryLink(Key key, bool dragging = true) { // Snap to key Vector3 origin = transform.position; if (key != null && key != m_LinkedKey && key.LinkToKey(this)) { // delink previous Key if (m_LinkedKey != null) { m_LinkedKey.RemoveFromKey(this); } m_LinkedKey = key; m_CanReplace = false; StartCoroutine(ResetItem()); } else { if (dragging) { // Let this item return to its original position transform.DOMove(m_DraggingOrigin, 0.3f, false); } PlaySound(m_SoundLinkFail); } }
public void ForceLink(Key key) { key.LinkToKey(this, true); // delink previous Key if (m_LinkedKey != null) { m_LinkedKey.RemoveFromKey(this); } m_LinkedKey = key; }